Difference between working storage copybook and



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Difference between working storage copybook and

Postby vinod_rana » Fri May 06, 2011 6:28 pm

Can anyone please answer my question?
What is the difference between working storage copybook and
linkage section copybook?
vinod_rana
 
Posts: 8
Joined: Thu Apr 21, 2011 12:58 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Difference between working storage copybook and

Postby prino » Fri May 06, 2011 7:11 pm

None whatsoever!
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 641
Joined: Wed Mar 11, 2009 12:22 am
Location: Vilnius, Lithuania
Has thanked: 3 times
Been thanked: 29 times

Re: Difference between working storage copybook and

Postby Ronald Burr » Fri May 06, 2011 7:23 pm

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.
Ronald Burr
 
Posts: 7
Joined: Wed Mar 23, 2011 8:18 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Difference between working storage copybook and

Postby BillyBoyo » Fri May 06, 2011 10:36 pm

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.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post