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

C/C++ Program Compilation
HP NonStop SQL/MX Programming Manual for C and COBOL544617-003
15-12
Preprocessor Functions
This #define directive:
#define SQL_Control_Table(defname)
EXEC SQL CONTROL TABLE defname TABLELOCK ‘OFF’;
SQL_Control_Table(fldrenty);
SQL_Control_Table(postact);
SQL_Control_Table(permdeny);
is expanded to:
EXEC SQL CONTROL TABLE fldrenty TABLELOCK 'OFF';
EXEC SQL CONTROL TABLE postact TABLELOCK 'OFF';
EXEC SQL CONTROL TABLE permdeny TABLELOCK 'OFF';
The preprocessor also expands #define directives that occur within host variable
parameters.
This #define directive:
#define MAX 255
EXEC SQL BEGIN DECLARE SECTION;
char mystr [MAX-1];
EXEC SQL END DECLARE SECTION;
is expanded to:
#define MAX 255
EXEC SQL BEGIN DECLARE SECTION;
char mystr [/*MAX-1*/ 254];
EXEC SQL END DECLARE SECTION;
C #line Directive
The preprocessor generates #line directives in the C/C++ annotated source file so
that the user, during debugging, is directed to the input source line number and file
name instead of the preprocessor-generated code that implements the embedded SQL
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