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-39
Combining Embedded Module Definitions and
Module Definition Files
 WORKING-STORAGE SECTION. 
 EXEC SQL DECLARE SCHEMA 'cat.sch' END-EXEC. 
 EXEC SQL MODULE sqlappmod END-EXEC. 
 ... 
 PROCEDURE DIVISION. 
 ... 
 EXEC SQL DECLARE get_by_partnum CURSOR FOR 
 SELECT partnum, partdesc, price, qty_available
 FROM =parts
 WHERE partnum >= :in_partnum
 FOR UPDATE OF partdesc, price, qty_available;
...
2. Set up class MAP DEFINEs in the OSS environment by using add_define:
add_define =parts class=map \
 file=\\bert.\$samdb.sales.parts
3. Run the SQL/MX COBOL preprocessor, COBOL compiler, native linker, and 
SQL/MX compiler in one command:
nmcobol -Wsqlmx -WmoduleSchema=cobcat.cobsch -Wmxcmp \
-Wmxcmp_querydefault="AUTOMATIC_RECOMPILATION=ON,\
RECOMPILATION_WARNINGS=ON,SIMILARITY_CHECK=ON" \
sqlutil.o sqlapp.ecbl -o sqlapp.exe
The nmcobol command:
•
Preprocesses the COBOL source file, sqlapp.ecbl, into an annotated 
source file, sqlapp.cbl, that contains embedded module definitions
•
Compiles the annotated source file into an object file, sqlapp.o
•
Links the object file, sqlapp.o, and the SQL COBOL utility routines in 
sqlutil.o into an executable file, sqlapp.exe
•
Generates a module named cobcat.cobsch.sqlappmod in the 
USERMODULES directory
Assuming that the compiled module of sqlutil.o is still current, the sqlapp.exe 
executable file is now runnable.










