Page 1 of 1

Difference between working storage copybook and

PostPosted: Fri May 06, 2011 6:28 pm
by vinod_rana
Can anyone please answer my question?
What is the difference between working storage copybook and
linkage section copybook?

Re: Difference between working storage copybook and

PostPosted: Fri May 06, 2011 7:11 pm
by prino
None whatsoever!

Re: Difference between working storage copybook and

PostPosted: Fri May 06, 2011 7:23 pm
by Ronald Burr
Actually, there are two differences I can think of offhand:
1) No storage is allocated for data elements (Copybook or otherwise) in the LINKAGE SECTION, and
2) If any data definitions in the Copybook include VALUE clauses, the VALUE clauses will be ignored if the Copybook is specified in the LINKAGE SECTION.

Re: Difference between working storage copybook and

PostPosted: Fri May 06, 2011 10:36 pm
by BillyBoyo
Prino is certainly correct, there is no difference in the copybook itself that would prevent you using it anywhere in the Data Division if all it contains is Cobol level numbers defining data.

Ronald expands, noting that they are differences between working-storage and linkage data, rather than being in a copybook.

If you have a copybook, I found it handy not to include the 01-level in it. This gives you more flexibility in using the copybook. Avoid values, except for 88's, unless the data is "static".

01-levels in the linkage section have to have an address aisgned to them before you can access the data. Most commonly, this is done by the USING on the PROCEDURE DIVISION. You can, these days, use methods like pointers to give addresses to tables in the LINKAGE SECTION. Any reference to something in LINKAGE that does not have an address asigned to it will give you S0C4 (there are many other ways of getting S0C4 as well). In LINKAGE, your copybook/definition is a "map" which can be assigned to start at a particular address. In WORKING-STORAGE, the copybook/definition is not only a map, but also causes storage to be set aside right there is your program which matches the map.