SQL/MX Programming Manual for C and COBOL (G06.24+, H06.03+)

COBOL Program Compilation
HP NonStop SQL/MX Programming Manual for C and COBOL523627-004
16-5
Compiling Embedded SQL COBOL Programs With
Embedded Module Definitions
6. Link application object files with object libraries to create an executable file by
either:
Running nmcobol with object files as input to link them:
nmcobol -o sqlprog.exe -lzclisrl sqlprog.o
Running the nld utility separately after compilation to resolve external
references in ENTER statements and implicit invocations of COBOL run-time
library routines that many COBOL statements cause:
nld -lzcobsrl -lzcresrl -lzclisrl -o sqlprog.exe sqlprog.o
ZCLISRL is a system library of the SQL/MX executor. You must specify this library
in the command line if you invoke the linker, either by running nld or by running
nmcobol without the -Wsqlmx or -Wmxcmp flag. If linking occurs when you invoke
nmcobol with the -Wsqlmx or -Wmxcmp flag, the list of libraries searched
automatically includes ZCLISRL.
7. The linker produces the application’s executable file, sqlprog.exe.
8. SQL compile one, some, or all of the application’s embedded module definitions in
the executable file by using mxCompileUserModule. See Running the
SQL/MX Compiler on page 16-22 and Compiling Embedded Module Definitions on
page 16-22.
mxCompileUserModule sqlprog.exe
9. The SQL/MX compiler produces the SQL/MX module. The module is stored in the
local application directory or in the global /usr/tandem/sqlmx/USERMODULES
directory.
Run the COBOL executable program.
Note. If you compiled a TNS/R native program with -Wcall_shared or -Wshared, you
must link it with the ld utility instead of the nld utility.
Note. The preprocessed COBOL source files are required for debugging. nmcobol has no
equivalent to the C/C++ #line directive.