SQL/MX Programming Manual for C and COBOL (H06.10+, J06.03+)
C/C++ Program Compilation
HP NonStop SQL/MX Programming Manual for C and COBOL—544617-003
15-60
Building SQL/MX Guardian Applications in the
Guardian Environment
Steps for Building an SQL/MX C Application in the Guardian
Environment
Use the next commands at a TACL prompt to preprocess, SQL compile, and compile
and link an SQL/MX C 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 progsql 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 progsql -c progc -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/E native compilation:
== Convert the annotated source file from an OSS text file
== (file code 180) to a Guardian text file (file code 101).
TACL> ctoedit progc,progsrc
== Call the CCOMP compiler to generate the object file.
TACL> ccomp/in progsrc,out progout/progo
== Call the eld linker to generate an executable file.
TACL> eld $system.system.ccplmain progo -o progexe &
-lzcredll -lzcrtldll -lzosskdll -lzi18ndll &
-lzicnvdll -lzclidll
For TNS/R native compilation:
== Convert the annotated source file from an OSS text file to
== a Guardian text file.
TACL> ctoedit progc,progsrc
== Call the NMC compiler to generate the object file.
TACL> nmc/in progsrc,out progout/progo
== 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










