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

Host Variables in C/C++ Programs
HP NonStop SQL/MX Programming Manual for C and COBOL523627-004
3-34
C Data Types Generated by INVOKE
If your application uses INVOKE to generate floating-point host variables for SQL/MX
columns, you should use the -o option. The -o option overrides the use of Tandem
floating point and uses IEEE floating point instead.
The -o option is particularly important for SQL/MX DOUBLE columns. If the -o option
is not used, INVOKE generates Tandem double host variables for SQL/MX DOUBLE
columns, which are in IEEE format. However, the range of IEEE DOUBLE is larger
than the range of Tandem DOUBLE, which could cause overflow or underflow errors
during the execution of the application. Therefore, verify that the -o option is specified
when using INVOKE on SQL/MX DOUBLE columns. For information on preprocessor
settings, see Running the SQL/MX C/C++ Preprocessor on page 15-8.
C Data Types Generated by INVOKE
To show the correspondence between a table named SQLCDATA that contains
columns of various SQL data types and the C structure generated by an INVOKE
statement, the INVOKE statement and struct declaration are coded:
EXEC SQL BEGIN DECLARE SECTION;
EXEC SQL INVOKE sqlcdata AS sqlc_types_struct;
struct sqlc_types_struct sqlc_types;
...
EXEC SQL END DECLARE SECTION;
The SQL/MX C preprocessor generates the structure immediately after the INVOKE
statement in the preprocessed program code.
Example 3-1 and Example 3-2 show the columns for the sqlcdata table and the
corresponding generated data types in the structure sqlc_types_struct.