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-57
Building SQL/MX Guardian Applications in the OSS
Environment
== Store terminal information in file templog.
== The source file must be file code 101.
== Call the SQL/MX preprocessor.
osh -c "mxsqlc progecpp -c progcpp -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 progcpp,progsrc
== Call the NMCPLUS compiler to generate the object file.
nmcplus/in progsrc,out progout/progo;version2
== 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
Building SQL/MX Guardian Applications in the OSS
Environment
You can use the c89 -Wsystype=guardian option to build an SQL/MX Guardian
application in the OSS environment. Follow these steps:
1. Create an embedded SQL/MX C/C++ source file (for example, prog.ec) in the
OSS environment.
2. Compile the C/C++ source file by using the -Wsystype=guardian option of the
OSS compiler utility:
c89 -Wsqlmx -Wmxcmp -Wsystype=guardian prog.ec \
-o prog.exe
3. Copy the executable file, prog.exe, from an OSS directory to a Guardian volume
and subvolume:
cp prog.exe /G/myvol/mysubvol/progexe
4. In the Guardian environment, assign file code 700 (for TNS/R native applications)
to the executable file:
TACL> fup alter progexe, code 700
5. Run the executable in the Guardian environment:
TACL> run progexe