Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linkage Section Initialization

Status
Not open for further replies.

TJ73

Programmer
Nov 14, 2023
8
US
So first - let’s say there is a Linkage Section variable defined as: 05 Important-Value Pic X(10) Value SPACE. Then let’s say some other program calls this program where the Important-Value variable being passed has a value of “Platinum”. Once our program gets up and running, will SPACE overwrite “Platinum” or will “Platinum” overwrite SPACE?
 
Normally, in the Linkage Section the variables should not have a VALUE clause.
In the case you mentioned, I would think that 'Platinum' overwrites SPACE, but to be sure, you should check it on a small example.
 
reading manuals normally help.
on those compiler vendors that do allow it the specification will normally be around this quote
VALUE clauses may appear in the File Section and the Linkage Section. They have no effect in these sections unless they are part of condition-name entries (level 88s) or named constants (level 78s).
Their presence in these two sections simplifies the management of COPY libraries. For example, if you plan to use the same COPY library in Working Storage in program-A and in Linkage in program-B, you need not remove the VALUE clauses in the Linkage Section.

so for all intents the value within the linkage is ignored and it is what is supplied on the calling program parameters that is used.

Regards

Frederico Fonseca
SysSoft Integrated Ltd

FAQ219-2884
FAQ181-2886
 
Thank you, both. Very helpful. Appreciated. Kind regards.
 
The linkage section is in fact not a storage area of the program in which it is defined. The calling program makes that area available, but only when everything is going the right way. When the called module with its linkage section is called, only a pointer is given, to point to that area, but without a definition. Only the pointer. So when the size is not right, everything can happpen, things you con't want.

An alternative can be a definition with the EXTERNAL option. IBM is using it in a way it is more failsave.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top