SQL/MX Programming Manual for C and COBOL (G06.24+, H06.03+)
C/C++ Program Compilation
HP NonStop SQL/MX Programming Manual for C and COBOL—523627-004
15-56
Building SQL/MX Guardian Applications in the
Guardian Environment
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 progecpp 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 "mxsqlc progecpp -c progcpp -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 -a 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 C++ compiler and linker.
For TNS/R native compilation, you can use either the default C++ library, which is
version3, or version2 in your NMCPLUS compiler command:
== Convert the annotated source file from an OSS text file to
== a Guardian text file.
TACL> ctoedit progcpp,progsrc
== Call the NMCPLUS compiler to generate the object file.
TACL> nmcplus/in progsrc,out progout/progo;version2
== Call the nld linker to generate an executable file.
TACL> nld $system.system.crtlmain progo -o progexe -obey &
$system.system.libcobey -lzclisrl -lzcplsrl &
-lztlhsrl -noverbose
6. Execute the executable:
TACL> run progexe
Using a TACL Macro to Build a C++ Guardian Application
Use a TACL macro file to combine and execute the commands. Use these sample
TACL macros to customize your own script. In the samples, the source file is located in
the Guardian environment and named progecpp. Remember that the source file must
be Guardian file code 101.
For TNS/R native compilation:
?tacl macro
param home /G/myvol/mysubvol