COBOL Manual for TNS/E Programs (H06.03+)
Source Program Organization and Format
HP COBOL Manual for TNS/E Programs—520347-003
2-16
Shared Data
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.










