IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Copybook structure in Load module


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Vai123

New User


Joined: 04 Dec 2008
Posts: 3
Location: Bangalore

PostPosted: Fri Sep 16, 2016 8:29 pm
Reply with quote

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
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Fri Sep 16, 2016 8:35 pm
Reply with quote

The question is Unclear.

You don't necessarily need to compile P2 if you don't want to.

.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Sep 16, 2016 9:01 pm
Reply with quote

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
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Fri Sep 16, 2016 9:15 pm
Reply with quote

The issue here is you are making an object to become inconsistent which is starting point of a failure.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3049
Location: NYC,USA

PostPosted: Fri Sep 16, 2016 9:43 pm
Reply with quote

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
View user's profile Send private message
Vai123

New User


Joined: 04 Dec 2008
Posts: 3
Location: Bangalore

PostPosted: Fri Sep 16, 2016 10:10 pm
Reply with quote

Very good information, Robert.. Thanks icon_smile.gif

Let me rephrase my question. Does load module already contain declaration of copybook variables like normal working storage variables?
Back to top
View user's profile Send private message
Vai123

New User


Joined: 04 Dec 2008
Posts: 3
Location: Bangalore

PostPosted: Fri Sep 16, 2016 10:13 pm
Reply with quote

This question is more from the informative purpose and precaution to avoid program malfunction.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Sep 16, 2016 10:37 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Load new table with Old unload - DB2 DB2 6
No new posts How to load to DB2 with column level ... DB2 6
No new posts REASON 00D70014 in load utility DB2 6
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts Trying to change copybook in online c... CICS 4
Search our Forums:

Back to Top