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

Issues Related to Linking
HP COBOL Manual for TNS/E Programs520347-003
24-3
Code and Data Blocks
How One Code Block Calls Another
At the source program level, one program calls another with a CALL or ENTER
statement; at the object program level, the calling program’s code block calls the called
program’s code block.
A CALL statement calls another COBOL program. Each CALL statement in a
compilation unit makes either an internal reference (calling another program in the
compilation unit) or an external reference (calling a program that is not part of the
compilation unit). In Figure 24-2, the first CALL statement makes an internal reference,
and the second CALL statement makes an external reference.
An ENTER statement calls a non-COBOL program. Each ENTER statement makes an
external reference.
When external references in two code blocks are resolved to entry points in each other,
the two code blocks are called “crossbound.” The system code block and the system
library blocks are all crossbound—a routine in any of these blocks can call a routine in
any other of these blocks. The blocks of a multiblock user code space are all
crossbound, as are the blocks of user library space.
Figure 24-2. Internal and External References
COBOL Source File
IDENTIFICATION DIVISION.
PROGRAM-ID. X.
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
. . .
CALL "Y".
CALL "Z".
IDENTIFICATION DIVISION.
PROGRAM-ID. Y.
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
Code
X
Data Data
COBOL Object File
Code
Y
Data Data
Internal ReferenceCompiler
External Reference (to Z)
VST703.vsd