COBOL Manual for TNS/E Programs (H06.03+)
Source Program Organization and Format
HP COBOL Manual for TNS/E Programs—520347-003
2-9
Directly Contained Programs and Indirectly
Contained Programs
Directly Contained Programs and Indirectly Contained Programs
One program can contain another program directly or indirectly. Suppose a program, L,
contains another program, R. Program L directly contains program R when program L
does not contain any other program that also contains program R. Program L indirectly
contains program R if program L does contain any other program that contains
program R.
In Figure 2-2, all the programs are in the same run unit and:
Scope of User-Defined Names
When a program directly or indirectly contains other programs, each program can use
identical user-defined names to name objects independent of the use of these user-
defined names by other programs. If program X describes a data item named B, and
program X includes another program Y, program Y can describe a different data item
named B (or even a file connector named B). The B of program Y is entirely separate
from the B of program X. The two Bs have different scopes.
The program … Directly contains … And indirectly contains …
Mane Aaa, Bbb Ccc, Ddd
Aaa Nothing Nothing
Bbb Ccc Ddd
Ccc Ddd Nothing
Ddd Nothing Nothing
Sub Nothing Nothing
Figure 2-2. Directly Contained Programs and Indirectly Contained Programs
Program: Mane
Program: Sub
One
separately compiled
program
Another
separately compiled
program
Program: Bbb
Program: Ccc
Program: Ddd
One run unit
Program: Aaa
VST501.vsd










