SQL/MX 3.2 Programming Manual for C and COBOL (H06.25+, J06.14+)
Program and Module Management
HP NonStop SQL/MX Release 3.2 Programming Manual for C and COBOL—663854-002
17-21
Versioning
Set up class MAP DEFINEs. Then set up an OSS environment variable,
TableSet, to supply both a module-tableset-specification-string and
the name of a subdirectory to which the intermediate files (including the” before-
link object file) and executable can be written.
export TableSet=TEST
add_define =DEPT class=MAP file=\\TEST.\$DATA.HR1.DEPT
add_define =EMPLOYEE class=MAP
file=\\TEST.\$DATA.HR1.EMPLOYEE
Invoke the shell script empcnt.sh. The shell script includes the lines:
mkdir ./$TableSet
mxsqlco empcnt.ecbl -c $TableSet/empcnt.cbl \
-m $TableSet/empcnt.m \
-g moduleTableSet=$TableSet
nmcobol -o ./$TableSet/empcnt.exe \
-Wcobol=”CONSULT /usr/tandem/sqlmx/lib/sqlcli.o” \
-lzclisrl ./$TableSet/empcnt.cbl
/G/system/system/mxcmp ./$TableSet/empcnt.m
The shell script makes a subdirectory that is named from the environment variable
$TableSet (which was set to TEST in the previous example). The script is written so
that the intermediate COBOL and module definition files are written into that
subdirectory by the preprocessor and read from that subdirectory by the COBOL
compiler and mxcmp, respectively. (See references to $TableSet on the command
lines for mxsqlco, nmcobol, and mxcmp.)
The script also uses the environment variable TableSet on the nmcobol command
line so that its output object file (empcnt.exe) is written into the subdirectory.
When you need to create another copy of the application to target a different set of
tables, export a different value for TableSet and set different values into the two
DEFINEs. For example:
export TableSet=PROD
add_define =DEPT class=MAP file=\\PROD.\$DATA.HR1.DEPT
add_define =EMPLOYEE class=MAP
file=\\PROD.\$DATA.HR1.EMPLOYEE
Then rerun the previous empcnt.sh shell script. The second set of intermediate files
and the .exe file are written to a different subdirectory. As in the first example, two
distinct module files have been created by the time the two builds complete:
/usr/tandem/sqlmx/USERMODULES/CAT.SCH.^EMP_CNT_MODULE^TEST^
/usr/tandem/sqlmx/USERMODULES/CAT.SCH.^EMP_CNT_MODULE^PROD^
Versioning
By using the version attribute for module management, you can create and use
multiple versions of an application from a single embedded SQL source file without
changing the MODULE directive or the catalog or schema. In the embedded SQL










