SQL/MX Programming Manual for C and COBOL (G06.24+, H06.03+)
COBOL Program Compilation
HP NonStop SQL/MX Programming Manual for C and COBOL—523627-004
16-12
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 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-44.
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
variable references are stored in the same order in which they appear in the SQL
statement.