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 COBOL—523627-004
3-33
INVOKE and Floating-Point Host Variables
INVOKE and Floating-Point Host Variables
For floating-point columns, INVOKE generates a structure that uses the Tandem or
IEEE floating-point format depending on whether the -o preprocessor option is used
during compilation. Table 3-8 lists the C declarations that INVOKE generates for each
type of floating-point column and shows the effect of the -o option on the floating-point
format and on the execution of the application.
Because the range of the IEEE REAL data type is smaller than the range of the
Tandem REAL data type, IEEE REAL host variables cannot accommodate data from
SQL/MP REAL columns, which are in Tandem floating-point format. If the -o
preprocessor option is used with invoked SQL/MP tables that have a column of type
REAL, this option causes the invoked structure to be of type DOUBLE, enabling values
from SQL/MP REAL columns to fit into an IEEE host variable.
Table 3-8. INVOKE and Floating-Point Host Variables
SQL Column Data
Type
Is the -o option
used during
compilation?
INVOKE-Generated
C Declaration
Outcome of
Application Execution
REAL SQL/MP column
(Tandem format)
No
*
float (Tandem) Successful execution
Yes
**
double (IEEE) Successful execution
FLOAT (1 to 22 bits)
SQL/MP column
(Tandem format)
No
*
float (Tandem) Successful execution
Yes
**
double (IEEE) Successful execution
FLOAT (23 to 54 bits)
SQL/MP column
(Tandem format)
No
*
double (Tandem) Successful execution
Yes
**
double (IEEE) Successful execution
DOUBLE PRECISION
SQL/MP column
(Tandem format)
No
*
double (Tandem) Successful execution
Yes
**
double (IEEE) Successful execution
but precision might be
lost
REAL SQL/MX column
(IEEE format)
No
*
float (Tandem) Successful execution
but precision might be
lost
Yes
**
float (IEEE) Successful execution
FLOAT (1 to 52 bits)
SQL/MX column (IEEE
format)
No
*
double (Tandem) Overflow or underflow
errors might occur.
Yes
**
double (IEEE) Successful execution
DOUBLE PRECISION
SQL/MX column (IEEE
format)
No
*
double (Tandem) Overflow or underflow
errors might occur.
Yes
**
double (IEEE) Successful execution
*
Default for TNS/R-targeted compilations
**
Default for TNS/E-targeted compilations