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-14
Binding or Linking Programs to Be Called
Dynamically
Binding or Linking Programs to Be Called Dynamically
A dynamic call is one in which the name of the called program is not known until run
time (see Dynamic Calls). Every program that a dynamic call could possibly call must
be bound into the run unit or user library before you execute the program. There are
several ways to do this:
•
Compile all the programs in the run unit from a single source file.
•
For a TNS program, use BIND to build the required program units into the run unit
or user library (see the Binder Manual).
•
For a native program, use the linker to build the required program units into the run
unit.
•
Refer to each possible called program explicitly in the source program—in a
paragraph that is not executed—and then call the ones you want with CALL
identifier statements.
At run time, if identifier specifies the name of a program that is unavailable, the
run-time routines raise an exception.
Binding With BIND
You can also bind a TNS HP COBOL program with BIND (the interactive form of
Binder, the HP object file building utility). One of the most common reasons to use
BIND is to replace one version of a program within an object file with a different version
of that program.
Topics:
•
Two Ways to Run BIND
•
Replacing a Code Block With One From Another Language
•
Replacing a Code Block With One With Different Parameters
Two Ways to Run BIND
Suppose you have an object file, BIGOBJ, made up of 15 separately compiled
HP COBOL programs. You have recompiled one of them, PART7, into the object file
OPART7. You want to create a new copy of BIGOBJ in which the old PART7 is
replaced by the new PART7.
You can run BIND interactively, giving BIND commands from a terminal (as in
Example 24-1), or you can run BIND noninteractively, letting it read its commands from
an OBEY command file (as in Example 24-2). The BIND prompt is @.
Note. This topic applies only to TNS programs. For native programs, see the nld Manual or
the ld Manual.