SQL/MX Programming Manual for C and COBOL (H06.10+, J06.03+)
COBOL Program Compilation
HP NonStop SQL/MX Programming Manual for C and COBOL—544617-003
16-8
Creating Modules: From Development to Production
•
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 the application’s module definition file by using the SQL/MX compiler
(mxcmp). See Running the SQL/MX Compiler on page 16-25 and Compiling a
Module Definition File on page 16-29.
mxcmp sqlprog.m
9. The SQL/MX compiler compiles the SQL source statements from the module
definition file in a module file, generates SQL object code for each statement,
determines an optimized execution plan for each SQL statement against the
database, and stores the code and plan in the SQL object program. The module is
stored in the local application directory or in the global
/usr/tandem/sqlmx/USERMODULES directory.
Run the COBOL executable program.
Creating Modules: From Development to Production
While HP recommends that you use embedded module definitions to create SQL
modules, you might find it easier for debugging purposes to use module definition files
during early stages of development and then switch to embedded module definitions
upon deployment of your production system. Consider this:
•
With embedded module definitions, you must successfully compile the output from
the preprocessor before you can SQL compile the embedded module definition.
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.










