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-11
Binding or Linking Automatically
You can use a predefined DEFINE, =_OBJECT_SEARCH, to specify one or more
subvolumes for the compiler to search for unqualified object files (see Specifying
Subvolumes to Be Searched for Unqualified Files).
Topics:
Establishing a Mnemonic Name for an Object File
Putting an Object File on the Primary Search List
Making an Object File the User Library
Putting an Object File on the Tertiary Search List
Establishing a Mnemonic Name for an Object File
If a CALL or ENTER statement contains a mnemonic name that specifies the object file
that contains the called program, the compiler searches that file (and only that file) for
the specified routine. If the compiler does not find the routine, it reports an error.
You establish a mnemonic name for an object file with a File-Mnemonic clause in the
SPECIAL-NAMES paragraph of the Environment Division. Suppose that the object file
has the system file name MYLIB and you want to give it the mnemonic name HERLIB.
The File-Mnemonic clause is:
FILE "MYLIB" IS HERLIB.
Suppose that MYLIB contains a COBOL program named APROG. Your HP COBOL
program can call APROG with the statement:
CALL "APROG" OF HERLIB.
Suppose that MYLIB is a TNS HP COBOL program and it contains a FORTRAN
program named APROG. Your HP COBOL program can call APROG with the
statement:
ENTER FORTRAN "APROG" OF HERLIB.
Quotation marks around the program name (APROG) are not required, but are
recommended. If, in some eventual program maintenance, someone adds a variable
named APROG to a program that already calls a program named APROG, and the
name APROG is not in quotation marks, the compiler assumes that APROG refers to
the variable. At run time, if the variable APROG does not contain the name of a valid
program that is included in the object file, the program terminates with the error
message “Called program not found.” If APROG is enclosed in quotes, the compiler
recognizes it as a program name rather than a variable.
Note. MYLIB must be a PIC file if the object file being created will be a PIC file.