SQL/MP Programming Manual for COBOL

Explicit Program Compilation
HP NonStop SQL/MP Programming Manual for COBOL529758-003
6-23
Binding and Linking
Binding and Linking
Binding TNS object files or linking native object files involves validating and resolving
references to other programs or routines and collecting and modifying code and data
blocks from one or more object files to produce a single object file.
The Binder or linker is a tool that you can use to read, link, modify, and build
executable object files. Follow these guidelines when you bind or link SQL program
files:
Handle SQL program files like other object files.
Bind or link object files after they are compiled by the HP COBOL compiler.
You can bind or link object files after running the SQL compiler. However, the
binding or linking operation invalidates the resulting target file, and you must then
explicitly recompile the program file to validate it.
SQL compile only the final bound or linked object. You are not required to
separately SQL compile each object of a multiple-module program.
Give a COBOL program a unique program name if you plan to bind or link it with
other programs.
The type of binding or linking process that occurs during compilation or that you can
use after compilation depends on the compilation mode that you use. For more
information, see:
The Binder Program on page 6-22
The nld or ld Utility on page 6-23
The Binder Program
Binding applies only to object files created in TNS mode by the COBOL85 compiler (or
by the cobol utility in the OSS environment of a TNS/R system). By default, the
COBOL85 compiler invokes the Binder program to bind the TNS object files. However,
in some cases, you might want to bind object files after compilation. For example, you
might want to replace one version of a program (in a object file that contains blocks
from several programs) with a new version of the program. The BIND command allows
you to invoke the Binder program interactively in the Guardian environment.
To run the Binder program interactively, enter BIND at the TACL prompt. The Binder
program displays its banner and prompt, an at sign (@). In this example, the Binder
commands combine the COBOBJ1 and COBOBJ2 files into an executable object file,
PROGFILE. The SELECT LIST * OFF command improves system performance by
turning off all listings.
:BIND
@ADD * FROM cobobj1
@ADD * FROM cobobj2