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

Issues Related to Linking
HP COBOL Manual for TNS/E Programs520347-003
24-5
Linking
How the Compiler Validates and Resolves References
The compiler translates each CALL statement and each ENTER statement in an
HP COBOL source program into an external reference. When the compiler generates
an implicit call to a routine that is to execute in another memory area, the parameters
match those expected by the routine. When you explicitly call a routine that is to
execute in another memory area (with an ENTER or X/Open CALL statement), the
compiler must verify that the parameters in the ENTER or X/Open CALL statement
match those expected by the external routine. To verify this, the compiler searches for
the routine (and as Figure 24-3 illustrates):
If the ENTER or X/Open CALL statement identifies the file that contains the routine
with a mnemonic name, the compiler searches that file only. If the compiler does
not find the routine in that file, it reports an error.
If the compiler does not identify the file that contains the routine, it searches for the
routine in the files on the primary search list if one exists. (One or more SEARCH
directives build the primary search list; see Putting an Object File on the Primary
Search List.)
If the compiler does not find the routine on the primary search list, it searches for
the routine in the files on the tertiary search list if one exists. (One or more
CONSULT directives build the tertiary search list; see Putting an Object File on the
Tertiary Search List.)
If the compiler does not find the routine in a file on the tertiary search list, it
searches for the routine in the file ECOBEXT, ZCOBDLL, and ZCREDLL.
If the compiler does not find the routines in ECOBEXT, ZCOBDLL or ZCREDLL, it
reports an error.
If the compiler cannot validate the parameters of an ENTER statement in a program
unit, it does not produce an object file for that program unit.
When the compiler generates an implicit reference to one of its own run-time routines
or to an operating system routine, the compiler leaves these references unresolved so
that the code of the corresponding routines will execute in system code space.