SQL/MX Programming Manual for C and COBOL (H06.10+, J06.03+)

Introduction
HP NonStop SQL/MX Programming Manual for C and COBOL544617-003
1-14
SQL/MX Compiler
When the preprocessor recognizes an EXEC SQL, it finds the corresponding
terminating semicolon (;) for C/C++ programs or the terminating keywords END-
EXEC for COBOL programs.
For each embedded SQL statement, the preprocessor scans the statement to find
host variable references and parses the statement to determine the required CLI
calls. If the statement is valid:
°
If using the default method, the preprocessor writes the embedded module
definitions in the 3GL source file.
°
If you choose to create a module definition file, the preprocessor writes the
output to the module definition file and the 3GL source file.
SQL/MX Compiler
The SQL/MX compiler opens the input program executable (when using Embedded
Module Definitions) or the input module definition file (when using Module Definition
files) and it opens the output module file that will contain the execution plans for the
SQL statements and performs the following functions:
Expands partially qualified SQL object names using the current default settings.
Expands view definitions.
Performs type checking for 3GL and SQL data types.
Checks SQL object references to verify their existence.
Determines an optimized execution plan and access path for each DML statement.
Generates executable code for the execution plans (if the SQL objects in the
statement are present at compile time) and creates a module in the
/usr/tandem/sqlmx/USERMODULES directory (or locally placed module
directory, if specified).
Generates a list of the SQL statements in the program file, including messages.
Returns a completion code indicating the outcome of the compilation.
Host Language Compiler
NonStop SQL/MX supports host applications written in C/C++ and COBOL. For
program preparation, see Section 15, C/C++ Program Compilation, and Section 16,
COBOL Program Compilation.
Program and Module Management
A variety of methods and features are available for managing your programs and
module files. See Section 17, Program and Module Management.