SQL/MX Programming Manual for C and COBOL (H06.04+)

C/C++ Program Compilation
HP NonStop SQL/MX Programming Manual for C and COBOL540434-001
15-14
Preprocessor Output
processes a C/C++ source file, such as source-file.sql, and generates two files:
the annotated source file (source-file.c in C or source-file.cpp in C++) and the
module definition file (source-file.m).
For more information on module management behavior and influencing the
preprocessor, see Module Management Behavior on page 17-7. For recommended
naming conventions for C/C++ source files, see Table 17-1 on page 17-1.
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.
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.