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-39
ecobol and nmcobol Examples With Embedded
Module Definitions
These commands preprocess, compile, link, and SQL compile a single COBOL
source file:
ecobol -Wsqlmx -Wmxcmp -o sqlprog.exe sqlprog.ecob
nmcobol -Wsqlmx -Wmxcmp -o sqlprog.exe sqlprog.ecob
The ecobol or 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
ecobol or 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:
ecobol -c -Wsqlmx sqlprog1.ecob sqlprog2.ecob \
sqlprog3.ecob
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:
ecobol -c -Wsqlmx file1.cbl file2.ecbl file3.ecob file4.cob
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 ecobol or 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 ecobol or nmcobol utility, create
the executable program by using the eld or nld utility to link one or more object
files. For example, these commands link sqlprog1.o , sqlprog2.o, and find the