View previous topic :: View next topic
|
Author |
Message |
Vai123
New User
Joined: 04 Dec 2008 Posts: 3 Location: Bangalore
|
|
|
|
Hi,
Does Cobol load module already contains the copybook structure? If yes, next question is-
Suppose Copybook ABC is used by programs P1 and P2. I updated the copybook for program P1. Why program P2 is also compiled though it is using its compatible version in load module?
I tried to search this topic but could not find relevant post. |
|
Back to top |
|
|
RahulG31
Active User
Joined: 20 Dec 2014 Posts: 446 Location: USA
|
|
|
|
The question is Unclear.
You don't necessarily need to compile P2 if you don't want to.
. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Copybooks are NOT used in a load module - they are source code only. A copybook defines a data structure, which is used by the load module, but the load module has no concept of the copybook.
A change to copybook ABC may be compatible or incompatible. Compatible changes do not change the existing variable definitions nor do they change the length of the defined record (adding a variable to the end of the definition and removing that many bytes of filler is an example of a compatible change). An incompatible change is one that changes the length of the record or inserts one or more variables, or changes the length of variables other than the last one, or deletes variables, or changes a variable USAGE, or rearranges the sequence of variables.
Compatible changes do NOT require any other programs to be recompiled -- just the program(s) affected by the change. Incompatible changes require every program that uses the copybook to be recompiled. Many sites, rather than figure out whether the change is compatible or not, will just recompile every program using the copybook whether or not such a recompile is required. Incompatible changes can cause all sorts of issues should every program using the copybook not be recompiled. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
The issue here is you are making an object to become inconsistent which is starting point of a failure. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3049 Location: NYC,USA
|
|
|
|
Vaishnavi,
Quote: |
Does Cobol load module already contains the copybook structure? If yes |
No, you could have looked yourself, hence the next question goes away automatically. For the point if you change the copybooks then certainly, you would want your programs to use the latest offsets otherwise you will expect errors like SOC4/SOC7 and if you chose to use the changeman ( other version control tool ) then it won't pass the Audit unless you recompile the program checked out in that package.
Quote: |
Why program P2 is also compiled though it is using its compatible version in load module? |
if the program P2 is in production then you don't have to but if they sitting in the same package and going together in production then yes. |
|
Back to top |
|
|
Vai123
New User
Joined: 04 Dec 2008 Posts: 3 Location: Bangalore
|
|
|
|
Very good information, Robert.. Thanks
Let me rephrase my question. Does load module already contain declaration of copybook variables like normal working storage variables? |
|
Back to top |
|
|
Vai123
New User
Joined: 04 Dec 2008 Posts: 3 Location: Bangalore
|
|
|
|
This question is more from the informative purpose and precaution to avoid program malfunction. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
A load module does not contain declarations of any variables; it contains storage for WORKING-STORAGE variables (whether declared in a copybook or in the actual program does not matter), and the program executable code works with offsets to registers to address the various bytes of memory. So, technically, a load module doesn't even reference variables as they are defined to the COBOL program -- it references memory locations and lengths. Note that copybooks that define records in the FD do not have memory allocated until the file OPEN occurs, so the load module may not have storage allocated for a copybooks at all.
You need to rid yourself of the idea that the executable code has any understanding of the data structures in the source code -- this simply is not the case. There are products that can retain the data structures and map them to memory when the program is executing, but these products generally work by making a copy of the data structures during the compile process so the copy can be referenced during execution. COBOL itself has nothing to do with such a process. |
|
Back to top |
|
|
|