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-54
Building SQL/MX Guardian Applications in the
Guardian Environment
environment. When you use the osh -c command, remember to enclose the entire 
command string after osh -c in double quotes. 
OSS-to-Guardian File Naming
When you issue OSS commands from a TACL prompt to preprocess and SQL compile 
an application, the Guardian file names change automatically. In the Guardian 
environment, the period is automatically dropped from the file name. 
For example, this OSS pass-through command preprocesses a C source file and 
generates an annotated source file and module definition file in the Guardian 
environment:
TACL> osh -c "mxsqlc prog.sql -c prog.c -m prog.m"
The annotated source file and module definition file in $MYVOL.MYSUBVOL are 
PROGC and PROGM. Be aware of the Guardian file name limitation of eight characters.
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
Note. When using OSS pass-through commands in the Guardian environment, be aware of 
the effect of #INFORMAT TACL on those commands. If #INFORMAT TACL is in effect for your 
session, you must put a tilde (~) before the pipe (|) symbol. Otherwise, the pipe symbol cannot 
reach the shell for execution because it has a programming function within TACL.










