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

COBOL Program Compilation
HP NonStop SQL/MX Programming Manual for C and COBOL544617-003
16-5
Compiling Embedded SQL COBOL Programs With
Embedded Module Definitions
mxCompileUserModule utility against all the object files rather than against the
executable file. When you SQL compile against the object files, NonStop SQL/MX
does not recompile each module for object files that are linked into more than one
executable file.
6. Link application object files with object libraries to create an executable file by
either:
Running ecobol or nmcobol with object files as input to link them:
ecobol -o sqlprog.exe -lzclidll sqlprog.o
nmcobol -o sqlprog.exe -lzclisrl sqlprog.o
Running the eld or 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:
eld -lzcobdll -lzcredll -lzclidll -o sqlprog.exe sqlprog.o
nld -lzcobsrl -lzcresrl -lzclisrl -o sqlprog.exe sqlprog.o
ZCLIDLL or 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
eld or nld or by running ecobol or nmcobol without the -Wsqlmx or -Wmxcmp
flag. If linking occurs when you invoke ecobol or nmcobol with the -Wsqlmx or
-Wmxcmp flag, the list of libraries searched automatically includes ZCLIDLL or
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-25 and Compiling Embedded Module Definitions on
page 16-25.
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. Neither ecobol nor
nmcobol has an equivalent to the C/C++ #line directive.