SQL/MX Programming Manual for C and COBOL (H06.10+, J06.03+)
COBOL Program Compilation
HP NonStop SQL/MX Programming Manual for C and COBOL—544617-003
16-12
Preprocessor Output
The COBOL 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 as the beginning
statement in the PROCEDURE DIVISION of your embedded SQL COBOL program.
For example:
EXEC SQL MODULE EXF62M NAMES ARE ISO88591 END-EXEC.
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 COBOL 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 COBOL 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 Common Run-
Time Errors on page 16-49.
Header Contains the data structures.
Body Contains the embedded SQL COBOL source file translated into
COBOL statements. The preprocessor converts each
embedded SQL statement to a COBOL comment by prefixing
an asterisk (*) to the statement 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 COBOL source
file. Definitions include the module version number, the creation
timestamp (the operating system timestamp when the
preprocessor was invoked), and the module name.










