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

Issues Related to Linking
HP COBOL Manual for TNS/E Programs520347-003
24-10
Linking Automatically
Putting an Object File on the Tertiary Search List
If the compiler does not find an external routine in the user library, it searches for the
routine in the object libraries on the tertiary search list. If the compiler finds the routine
in a library on the tertiary search list, it validates the routine’s actual parameters but
does not include the routine in your object file. The system loader resolves the routine
at fixup.
You can put one or more object libraries on the tertiary search list with one or more
CONSULT directives. The first CONSULT directive establishes the tertiary search list,
adding files to it in the specified order. Subsequent CONSULT directives append
libraries to the tertiary search list in the specified order. The compiler searches the
libraries of the tertiary search list in order. If the compiler finds the routine, it stops
searching for it. Object libraries on the tertiary search list are not bound into the
loadfile.
Suppose that the files RTNS1985 and RTNS1988 contain object code for external
routines that your HP COBOL program calls, and that most of the external routines that
your program calls are in RTNS1988. For greatest efficiency, put RTNS1988 first on
the tertiary search list. You can use the directive:
?CONSULT RTNS1988,RTNS1985
You could also use multiple CONSULT directives, which can be anywhere in your
HP COBOL program. This code produces the same tertiary search list as the
preceding directive:
?CONSULT RTNS1988
?CONSULT RTNS1985
If you also put a CONSULT directive on the compilation command line when you
compile your program, the compiler sees it first, so the tertiary search list begins with
the object libraries in the CONSULT directive on the compilation command line.
If the compiler does not find the routine in any object file on the tertiary search list, it
searches for the routine in the file ECOBEXT, ZCOBDLL, or ZCREDLL. If the ECOBOL
compiler does not find the routine in ECOBEXT, ZCOBDLL, or ZCREDLL, the compiler
reports an error.