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-41
Building SQL/MX Guardian Applications in the
Guardian Environment
For example, this OSS pass-through command preprocesses a COBOL source file and
generates an annotated source file and module definition file in the Guardian
environment:
TACL> osh -c "mxsqlco prog.ecob -c prog.cbl -m prog.m"
The annotated source file and module definition file in $MYVOL.MYSUBVOL are
PROGCBL and PROGM. Be aware of the Guardian file name limitation of eight
characters.
Steps for Building an SQL/MX Application in the Guardian
Environment
Use the next commands at a TACL prompt to preprocess, SQL compile, and compile
and link an SQL/MX COBOL program.
1. To make the source file in the Guardian environment accessible to an OSS
process, enter this command, replacing myvol.mysubvol with your default
Guardian volume and subvolume:
param home /G/myvol/mysubvol
The source file named progecob in $MYVOL.MYSUBVOL must be Guardian file
code 101.
2. To invoke the SQL/MX preprocessor, which is an OSS process, enter an OSS
pass-through command at a TACL prompt:
TACL> osh -c "mxsqlco progecob -c progcbl &
-m progm |tee templog"
3. To invoke the SQL/MX compiler, which is an OSS process, enter an OSS pass-
through command at a TACL prompt:
TACL> osh -c "/G/system/system/mxcmp progm |tee templog"
4. Errors generated by the SQL/MX preprocessor or SQL/MX compiler are logged in
the OSS file templog. To convert the error log to a Guardian file:
TACL> purge proglog
TACL> ctoedit templog,proglog
5. Run the Guardian COBOL compiler and linker.
For TNS/R native compilation:
== Convert the annotated source file from an OSS text file to
== a Guardian text file.
TACL> ctoedit progcbl,progsrc
== Call the NMCOBOL compiler to generate the object file.
TACL> nmcobol /in progsrc,out progout/progo; &
consult $system.system.sqlclio
== Call the nld linker to generate an executable file.
TACL> nld -lzcobsrl -lzcresrl -lzclisrl progo &
-o progexe