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-42
ecobol and nmcobol Examples With Module
Definition Files
•
These commands preprocess, compile, link, and SQL compile a single COBOL
source file:
ecobol -Wsqlmx -Wsqlmxadd=-x -Wmxcmp -o sqlprog.exe \
sqlprog.ecob sqlprog.m
nmcobol -Wsqlmx -Wsqlmxadd=-x -Wmxcmp -o sqlprog.exe \
sqlprog.ecob sqlprog.m
The ecobol or nmcobol utility invokes the preprocessor, mxsqlco, which uses
the file sqlprog.ecob as input and produces two files: sqlprog.cbl and
sqlprog.m. The file sqlprog.cbl is the COBOL annotated source file, and the
file sqlprog.m is the corresponding module definition file. 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
module definition file sqlprog.m with the SQL/MX compiler, mxcmp, to produce
the module.
•
These commands preprocess several COBOL source files and compile them, but
they do not link the results:
ecobol -c -Wsqlmx -Wsqlmxadd=-x sqlprog1.ecob \
sqlprog2.ecob sqlprog3.ecob
nmcobol -c -Wsqlmx -Wsqlmxadd=-x sqlprog1.ecob \
sqlprog2.ecob sqlprog3.ecob
If no errors are detected in either the preprocessing or compiling steps, these files
are created: sqlprog1.m, sqlprog2.m, sqlprog3.m, 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 -Wsqlmxadd=-x file1.cbl file2.ecbl \
file3.ecob file4.cob
nmcobol -c -Wsqlmx -Wsqlmxadd=-x 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.m, file2.cbl, file3.m, file3.cob, file1.o, file2.o,
file3.o, file4.o.
•
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










