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-55
Building SQL/MX Guardian Applications in the
Guardian Environment
5. Run the Guardian C 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 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
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 progsql. Remember that the source file must
be Guardian file code 101.
For TNS/R native compilation:
?tacl macro
param home /G/myvol/mysubvol
== Store terminal information in file templog.
== The source file must be file code 101.
== Call the SQL/MX preprocessor.
osh -c "mxsqlc progsql -c progc -m progm ~|tee templog"
== Call the SQL/MX compiler.
osh -c "/G/system/system/mxcmp progm ~|tee -a templog"
== Convert OSS text files to Guardian text files.
sink [#purge proglog]
ctoedit templog,proglog
ctoedit progc,progsrc
== Call the NMC compiler to generate the object file.
nmc/in progsrc,out progout/progo;nowarn
== Call the nld linker to generate an executable file.
nld $system.system.crtlmain progo -o progexe -obey &
$system.system.libcobey -lzclisrl -lzcplsrl -lztlhsrl -noverbose
== Execute the executable.
run progexe
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.