SQL/MX 3.2 Programming Manual for C and COBOL (H06.25+, J06.14+)

C/C++ Program Compilation
HP NonStop SQL/MX Release 3.2 Programming Manual for C and COBOL663854-002
15-36
Running the SQL/MX Compiler
On Windows, you can run the C/C++ compiler and native object file linker from ETK, or
you can use the command-line cross compiler c89 and the linker (eld or nld). For
details on syntax and using the C/C++ cross compiler with ETK, see the help file Using
Command-Line Cross Compilers on Windows, which is included with ETK.
To run the C/C++ compilers, see the C/C++ Programmers Guide. To run the eld
linker, see the eld Manual. To run the nld linker, see the nld Manual. For more
information on the c89 utility, see c89 Utility: Using One Command for All Compilation
Steps on page 15-44, the OSS reference pages, or the Open System Services Shell
and Utilities Reference Manual.
Running the SQL/MX Compiler
The SQL/MX compiler compiles and optimizes static and dynamic SQL statements for
subsequent execution by the SQL/MX executor and performs these functions:
Expands SQL object names by using the current default settings
Expands view definitions
Performs type checking for C/C++ and SQL data types
Checks SQL object references to verify their existence
Determines an optimized execution plan and access path for each DML statement
if the SQL objects in the statement are present at compile time
Generates executable code for the execution plans (if the SQL objects in the
statement are present at compile time) and creates a module in the user-specified
local application directory, user-specified Guardian or OSS location(s) or both,
application DLL location(s), or in the global /usr/tandem/sqlmx/USERMODULES
directory.
Generates a list of SQL statements in the program file, including messages
Returns a completion code indicating the outcome of the compilation
The SQL/MX compiler is an OSS program installed in the Guardian $SYSTEM.SYSTEM
subvolume (/G/system/system/ in the OSS environment). You must run the
compiler in the OSS environment. It does not run as a Guardian process.
You must explicitly invoke the SQL/MX compiler to compile static SQL statements. At
run time, the SQL/MX executor also invokes the compiler to compile dynamic SQL
statements and to recompile any static SQL statements that refer to database objects
that have changed and that affect the SQL statement’s execution plan.
If your program accesses a table that has changed since the last static compilation,
you should statically recompile the program to improve performance. Otherwise,
NonStop SQL/MX dynamically recompiles the program before each execution.
Note. The default C++ run-time library for CPPCOMP and NMCPLUS is version3. You can
use either version3 or version2 when you issue your C++ compiler command.