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

Program Compilation
HP COBOL Manual for TNS/E Programs520347-003
11-9
CALL and ENTER Statement Processing: Overview
In the CALL statement, the called program must be a COBOL program. It can be part
of the same compilation unit as the calling program, or it can be an external reference
to a COBOL program outside the compilation unit (but in the same object file). All
ENTER statements cause external references, because they call programs compiled
from source languages other than COBOL.
To generate the proper code to call a separately compiled program, the compiler needs
a description of the parameter list of that program. Each CALL or ENTER statement
can include qualification that specifies where the compiler must find the program.
Although the compiler must search for unqualified programs, qualification significantly
restricts the activity of the compiler.
Topics:
Qualified References
How the Compiler Resolves Unqualified References
Qualified References
Each CALL or ENTER statement can include a file-mnemonic that identifies the
object file where the linker must look for the called program, resolving the external
reference and including the called program’s object code in the target file. You must
associate this file-mnemonic with the object file’s file-system file name in the
SPECIAL-NAMES paragraph in the Environment Division that governs the calling
program. (Either the calling program is not nested, and contains an Environment
Division; or the calling program is nested, and its outermost containing program
contains an Environment Division.)
If the compiler does not find the program in the specified object file, it reports an error
and creates no code or data blocks for the program unit. Example 11-1 contains three
examples of qualified references.
How the Compiler Resolves Unqualified References
When a program name is not qualified and the program it names is not in the
compilation unit (such as the call to A-FRIEND in Example 11-1) the compiler resolves
the reference in one of these ways:
If you provided one or more search lists, the compiler examines those files in
sequence for program names that correspond to the external references.
If you did not provide search lists, or if the compiler did not find the necessary
external references on them, it examines ECOBEXT for resolution of external
references.
You create primary and tertiary search lists with the SEARCH, LIBRARY, and
CONSULT directives, respectively. (The ECOBOL compiler does not recognize the
LIBRARY directive or have a user library, the secondary search list.) You can also use
the predefined SEARCH DEFINEs to specify one or more subvolumes to be searched
for unqualified files (see Predefined SEARCH DEFINEs).