COBOL Manual for TNS and TNS/R Programs

Issues Related to Binding and Linking
HP COBOL Manual for TNS and TNS/R Programs522555-006
24-10
Binding or Linking Automatically
Binding or Linking Automatically
By default, the COBOL85 compiler automatically binds the program, interacting with
the BINSERV process as explained under Binder.
If you specify the RUNNABLE directive but not the CALL-SHARED or SHARED
directive, the NMCOBOL compiler automatically links the program, interacting with the
COBOLFE process and the nld utility.
If you specify the RUNNABLE directive and either the CALL-SHARED or SHARED
directive, the NMCOBOL compiler automatically links the program, interacting with the
ld utility.
For simplicity, this explanation attributes actions of BINSERV, COBOLFE, and the nld
utility to the compiler.
Unless all the external routines that your program calls are in the file COBOLEXT (for
TNS programs) or NMCOBEXT, ZCOBSRL, or ZCRESRL (for native programs), you
must tell the compiler which object files contain the external routines that your program
calls. There are several ways to tell the compiler about a specific object file:
Establish a mnemonic name for the object file and use it in CALL or ENTER
statements.
Put the object file’s name on the primary search list.
If the COBOL85 compiler finds an external routine in an object file on the primary
search list, it validates the routine’s parameters and includes the routine in your
program’s object file.
If the NMCOBOL compiler finds an external routine in an object file on the primary
search list, it validates the routine’s parameters and includes the entire object file in
your program’s object file.
For a TNS program, make the object file the TNS user library (the only file on the
secondary search list). For a native program, make the object file the user library.
If the COBOL85 compiler finds an external routine in the user library, it validates
the routine’s actual parameters but does not include the routine in your program’s
object file. The system loader resolves the routine at fixup.
You can only specify one user library, so if your program calls external routines
from more than one object file (excluding COBOLEXT or NMCOBEXT), you must
establish mnemonic names for the other object files or put each of them on a
search list.
Put the object file’s name on the tertiary search list.
If the compiler finds an external routine in an object file on the tertiary search list, it
validates the routine’s actual parameters but does not include the routine in your
program’s object file. The system loader resolves the routine at fixup.