COBOL Manual for TNS/E Programs (H06.08+, J06.03+)

The CALL statement can call another program statically (with the program specified at compilation
time) or dynamically (with the program specified at run time). The former is more efficient; the latter
is more flexible.
The CALL statement can pass parameters from the calling program to the called program either
by reference (the default) or by content.
Topics:
Separately Compiled HP COBOL Programs
Nested HP COBOL Programs
Common Programs
Initial Programs
Static Calls
Dynamic Calls
Separately Compiled HP COBOL Programs
A separately compiled program is an HP COBOL source program that is not nested within any
other program. A compilation unit—a collection of source statements presented to a compiler in
one compilation—contains one or more separately compiled programs. Separately compiled
programs in the same compilation unit can call each other.
Any separately compiled program with no Linkage Section can be a main program (that is, the
program with which execution begins). If more than one of the programs in a compilation unit has
no Linkage Section, one program must include a MAIN directive to identify it as the main program.
Nested HP COBOL Programs
Nested HP COBOL programs are contained in other HP COBOL programs. Nested programs can
be directly or indirectly contained. In Figure 32, the compilation unit contains two separately
compiled programs (Mane and Sub), which contain nested programs, and the programs have
these relationships:
And indirectly contains ...Directly contains ...The program ...
Ccc, DddAaa, BbbMane
NothingNothingAaa
DddCccBbb
NothingDddCcc
NothingNothingDdd
NothingNothingSub
Calling Other COBOL Programs 795