Should the programs be recompiled?

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Previous topicNext topic

Topic author
Kapil Sharma
Registered Member
Posts: 26
Joined: Sun Sep 29, 2013 1:46 am
Location: India

Should the programs be recompiled?

Post by Kapil Sharma » Wed Oct 11, 2017 3:30 pm

Hi,

I have a structure in a COBOL copybook like this:

Code: Select all

05 TB-ABCD-ENTRY.                                            
   10 TB-ABCD-COMPANY-CODE           PIC X(02)  VALUE SPACES.
   10 TB-ABCD-ONLINE-FRT-CONS-SW     PIC X(01)  VALUE ' '.   
      88 TB-ABCD-ONLINE-FRT-CONS                VALUE 'Y'.   
   10 FILLER                         PIC X(197).             
From the FILLER we are picking up 4 character for a new value like this:

Code: Select all

05 TB-ABCD-ENTRY.                                            
   10 TB-ABCD-COMPANY-CODE           PIC X(02)  VALUE SPACES.
   10 TB-ABCD-ONLINE-FRT-CONS-SW     PIC X(01)  VALUE ' '.   
      88 TB-ABCD-ONLINE-FRT-CONS                VALUE 'Y'.   
   10 WS-NEW-VAR                     PIC X(04).             
   10 FILLER                         PIC X(193).             
Should we recompile all the programs which are using this file. I believe we don't need to recompile as the length is not changed.


Thanks,
Kapil

User avatar

Robert Sample
Global Moderator
Global Moderator
Posts: 1289
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa

Re: Should the programs be recompiled?

Post by Robert Sample » Wed Oct 11, 2017 5:19 pm

While programs using the copy book do not require compilation, it is wise to always recompile every program whenever variables are added to the copy book (even if the length does not change) since there could be variables in the programs with the same name.



User avatar

Anuj Dhawan
Founder
Posts: 2418
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India

Re: Should the programs be recompiled?

Post by Anuj Dhawan » Wed Oct 11, 2017 10:28 pm

Robert Sample wrote:
Wed Oct 11, 2017 5:19 pm
While programs using the copy book do not require compilation, it is wise to always recompile every program whenever variables are added to the copy book (even if the length does not change) since there could be variables in the programs with the same name.
I always thought that there is just no need to compile the programs and it did worked over the years. Thinking about your statement, Robert, it looks like I had been lucky, most of the times! :)


Thanks,
Anuj

User avatar

Robert Sample
Global Moderator
Global Moderator
Posts: 1289
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa

Re: Should the programs be recompiled?

Post by Robert Sample » Wed Oct 11, 2017 11:42 pm

Not necessarily lucky -- it would be rare indeed for a program variable to have the same name as a copy book variable since there are usually naming standards. But I did see it happen once early in my career and since then I've always erred on the side of caution.



User avatar

Anuj Dhawan
Founder
Posts: 2418
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India

Re: Should the programs be recompiled?

Post by Anuj Dhawan » Thu Oct 12, 2017 9:09 am

That make sense. Thanks - will keep that in mind.

[ Post made via Android ] Image


Thanks,
Anuj


enrico-sorichetti
Global Moderator
Global Moderator
Posts: 836
Joined: Wed Sep 11, 2013 3:57 pm

Re: Should the programs be recompiled?

Post by enrico-sorichetti » Thu Oct 12, 2017 9:49 am

recompilation depends also on the setup of Your source control system ...
a change in a copybook might force a rebuild of all the sources including it

the sequence of command used might change depending on the source control system used


cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort 8-)

Previous topicNext topic

Return to “IBM COBOL, GnuCOBOL (OpenCOBOL), OOCobol.”