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-12
Preprocessor Functions
statement. The preprocessor uses the source line number and input file name when
reporting error and warning messages.
If the preprocessor encounters a #line directive, it updates the current source line
number and input file name (if specified) from the directive.
C/C++ Comments
The preprocessor ignores C and C++ comments unless the comment specifies a name
for an SQL statement. You can use a comment to name an SQL statement explicitly.
To do so, precede the statement with a C comment using the format:
/* SQL statement_name = name [ comment-text ] */
EXEC SQL sql_statement ... ;
The name is an SQL identifier you are assigning as the name of sql_statement, and
comment-text is an optional comment that does not affect the assignment of the
name. The C/C++ comment must use only one line and must immediately precede the
SQL statement.
For example, this comment names the SQL statement (INSERT) and provides
comment text (“insert ten rows”):
/* SQL statement_name= INSERT insert ten rows */
EXEC SQL INSERT INTO ...;
If you do not specify a name for an SQL statement, the preprocessor assigns the
statement a name of the form SQLMX_DEFAULT_STATEMENT_n, where n is an integer
incremented by the preprocessor.
Host Variable Declarations
The preprocessor checks each host variable declaration (that is, a variable declared
between BEGIN DECLARE SECTION and END DECLARE SECTION) to ensure that
the variable uses a valid data type. For valid host-variable data types, see Table 3-1 on
page 3-8 and Table 3-4
on page 3-10.
The preprocessor parses INVOKE as a valid embedded SQL statement within a host
variable declaration section. The preprocessor returns an error for embedded SQL
statements that are not valid within a host-variable declaration section.
SQLSTATE must be declared within a Declare Section. See Declaring SQLSTATE
on
page 13-1.
Floating-Point Format
In SQL/MX Release 2.x, the preprocessor operates in ANSI IEEE floating-point format.
In previous releases, the preprocessor used Tandem floating-point format. If you have
applications that use floating-point data types and host variables, see Assigning
Floating-Point Data Types on page 3-21.