COBOL Manual for TNS and TNS/R Programs
Source Program Organization and Format
HP COBOL Manual for TNS and TNS/R Programs—522555-006
2-18
Shared Data
Linkage Section Records
Data records and any subordinate data items in the Linkage Section are
representatives of data items defined in other programs. They are considered to be
internal to the program describing them and are directly accessible only to that
program; however, they are indirectly accessible to programs called by that program.
Shared Data
Two programs in a run unit can refer to common data in these circumstances:
•
Any program that has described an external data record can refer to the data
content of that record.
•
If program B is contained within program A, both programs can refer to data
possessing the global attribute and described in either:
°
The containing program A
°
Any program that directly or indirectly contains A
•
When a program passes a parameter value by reference, this establishes a
common data item—a storage location that each program can access. The called
program can refer to a data item in the calling program, using the same identifier or
a different identifier.
If several programs define a data item as external (causing its storage location to be a
single location outside all programs) and they also define the data item as having a
global name, then all such programs and all programs nested within each of them have
access to the data item.
Example 2-2 is a listing of a set of programs that share data through the global and
external mechanisms. Example 2-3 shows the output produced by executing the
programs.