SQL/MX Programming Manual for C and COBOL (G06.24+, H06.03+)
COBOL Program Compilation
HP NonStop SQL/MX Programming Manual for C and COBOL—523627-004
16-8
Creating Modules: From Development to Production
•
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 the application’s module definition file by using the SQL/MX compiler
(mxcmp). See Running the SQL/MX Compiler on page 16-22 and Compiling a
Module Definition File on page 16-26.
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.
You must diagnose host language errors in the source program before you can
diagnose SQL errors in the source program.
•
With module definition files, you compile the source file and the module definition
file at the same time. This method provides the opportunity to diagnose both host
language errors and SQL errors in the source file concurrently.
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.