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-14
Preprocessor Output
The preprocessor converts embedded SQL statements to C comments, followed by the
appropriate CLI calls.
The C/C++ annotated source file consists of:
Header for Module Definition File
If you specify the -m or -x preprocessor option or set the
SQLMX_PREPROCESSOR_VERSION=800 environment variable, the preprocessor
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
Header Contains the declarations within the CLI functions and data
structures.
Body Contains the embedded SQL C/C++ source file translated into
C/C++ statements. The preprocessor encloses each embedded
SQL statement with C comment delimiters and follows the
commented statement with a CLI call that invokes the executor
at run time to execute the statement.
Trailer Contains definitions required to complete the C/C++ source file.
Definitions include the module version number, the creation
timestamp (the operating system timestamp when the
preprocessor was invoked), and the module name.