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-65
Running the SQL/MX Program File
the SQL statement, along with code to handle parameter passing and error processing.
At run time, the calls to the CLI pass in a descriptor of the statement, which gives the
statement name, the module name, and a module timestamp.
The CLI begins processing each call by checking that it has the associated module in
memory. If not, it uses the module name to find the correct module file in the
application’s base directory. If a co-located module is not found there, it looks for the
module file in the /usr/tandem/sqlmx/USERMODULES directory. Before it reads in
the compiled SQL plans from a module file, the CLI also checks that the module
timestamp encoded in the module file matches the module timestamp passed in from
the C/C++ application.
If the application consists of more than one separately compiled module, when the first
statement from the module is executed, the sequence of reading the module file and
checking its module timestamp is performed and repeated for each module associated
with the application.
Security of the /usr/tandem/sqlmx/USERMODULES directory is very important. You
should restrict access so that users cannot alter the query plans in the modules or
remove modules. For information on securing modules, see the SQL/MX Installation
and Management Guide.
Running the SQL/MX Program File
An SQL/MX program can run in the OSS or in the Guardian environment. You can use
the GTACL command to start a Guardian program from OSS. You can use the osh
command to start an OSS program from a Guardian TACL session.
•
From the OSS environment, enter the program file name at the OSS shell prompt.
You can also use the OSS run command to run the program file by using specific
Guardian attributes (for example, a CPU or priority for the process).
•
From the Guardian environment, use the TACL osh command to run the program.
For more information, see Building SQL/MX C/C++ Applications to Run in the
Guardian Environment on page 15-58.
For more information on the run or osh command, see the Open System Services
Shell and Utilities Reference Manual or the OSS reference pages.
Understanding and Avoiding Some Common Run-Time Errors
The details of how a C/C++ executable is linked with its module or modules are
handled by the system and take place in the background. However, by understanding
this process and why certain run-time errors occur, you can avoid some common
SQL/MX application development issues.










