COBOL Manual for TNS and TNS/R Programs
Issues Related to Binding and Linking
HP COBOL Manual for TNS and TNS/R Programs—522555-006
24-6
Binding or 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 in a file on the primary search list, it
searches for the routine in the user library, if one exists; see Making an Object File
the User Library.
•
If the compiler does not find the routine in the user library, 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 COBOLEXT (for a TNS program) or
NMCOBEXT, ZCOBSRL, and ZCRESRL (for a native program).
•
If the compiler does not find the routines in COBOLEXT or NMCOBEXT, 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.