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-36
nmcobol Examples With Embedded Module
Definitions
These commands preprocess, compile, link, and SQL compile a single COBOL
source file:
nmcobol -Wsqlmx -Wmxcmp -o sqlprog.exe sqlprog.ecob
The nmcobol utility invokes the preprocessor, mxsqlco, which uses the file
sqlprog.ecob as input and produces one file: sqlprog.cbl, which is a COBOL
annotated source file that contains embedded module definitions. The nmcobol
utility then compiles and links sqlprog.cbl to produce the executable file,
sqlprog.exe. The SQL/MX compiler command -Wmxcmp processes the
executable file with the SQL/MX compiler, mxCompileUserModule, to produce
the module.
These commands preprocess several COBOL source files and compile them but
do not link the results:
nmcobol -c -Wsqlmx sqlprog1.ecob sqlprog2.ecob \
sqlprog3.ecob
If no errors are detected in either the preprocessing or compiling steps, these files
are created: sqlprog1.cob, sqlprog2.cob, sqlprog3.cob, sqlprog1.o,
sqlprog2.o, and sqlprog3.o.
These commands preprocess and compile COBOL source files with and without
embedded SQL without linking:
nmcobol -c -Wsqlmx file1.cbl file2.ecbl file3.ecob file4.cob
If no errors are detected in either the preprocessing or compiling steps, these files
are created: file2.cbl, file3.cob, file1.o, file2.o, file3.o, and
file4.o.
The nmcobol utility provides commands that pass through options to the SQL/MX
preprocessor and the SQL/MX compiler (-Wsqlmxadd and
-Wmxcmp_add, respectively). To preprocess files with preprocessor options, use
the -Wsqlmxadd option:
-Wsqlmxadd=-a
To pass a single option, do not use quotes or white space characters. To pass
multiple options, place them within double quotes and separate the options with a
white-space character:
-Wsqlmxadd="-a -m -c test.cbl"
If you did not link your object files by using the nmcobol utility, create the
executable program by using the nld utility to link one or more object files. For
example, these commands link sqlprog1.o , sqlprog2.o, and find the required
CLI procedure definitions to create an executable file named sqlprog.exe:
nld -lzcobsrl -lzcresrl -lzclisrl sqlprog1.o sqlprog2.o \
-o sqlprog.exe
For more information on nld, see the nld Manual.