SQL/MX 3.2.1 Programming Manual for C and COBOL (H06.26+, J06.15+)
C/C++ Program Compilation
HP NonStop SQL/MX Release 3.2.1 Programming Manual for C and COBOL—663854-005
15-18
Preprocessor Output
creates a module definition file in your current directory that contains embedded SQL
statements. The preprocessor writes the header of the module definition file as:
MODULE module-name NAMES ARE ISO88591;
TIMESTAMP DEFINITION ( creation_timestamp );
source-file 'source-file location';
You can specify module-name by using the MODULE directive in your embedded
SQL C/C++ program. For example:
EXEC SQL MODULE TX015.SQLPP.T0003N12;
The preprocessor translates this MODULE directive into:
MODULE TX015.SQLPP.T0003N12 NAMES ARE ISO88591;
TIMESTAMP DEFINITION (2110378403655251203)
SOURCE_FILE '/E/KINGPIN/usr/test/qalib/mxR2/cct0003/n12.ppp';
Otherwise, if you do not specify a MODULE directive, the preprocessor generates a
system-supplied module name for you. See also the MODULE directive in the SQL/MX
Reference Manual.
Trailer for Annotated-Source File
The module-name and the creation_timestamp correspond to these same
elements in the trailer of the C/C++ source file. The SQL/MX compiler uses module-
name to name the module file. It also writes the creation_timestamp into the
module file. The C/C++ source file is then compiled and linked. When the resulting
program file is executed and calls the SQL/MX executor, the preprocessor-generated
CLI procedure calls pass the module-name and creation_timestamp to the
executor. The executor uses the module-name to locate the corresponding module
file. The creation_timestamp is used to ensure that the version of the executable
program is synchronized with the version of the module file. This strategy prevents, for
example, the executable program from being altered and rebuilt without rebuilding the
module file. For more information, see Understanding and Avoiding Some Common
Run-Time Errors on page 15-73.
The ISO88591 character set is the default character set for CHAR or VARCHAR data
types for NonStop SQL/MX.
Procedures
After writing to the header of the module definition file, the preprocessor writes
procedures for executing SQL statements. A procedure consists of a name, a formal
argument list, and an SQL statement as the body of the procedure.
Each formal argument has a name and an SQL data type. The arguments are the host
variables that occur in the SQL statement in the body of the procedure. The
preprocessor writes the arguments in the same order as the first occurrence of the host
variables, scanning from left to right, in the SQL statement. In some cases, the
arguments are data structures that contain references to host variables. The host










