SQL/MX 3.2.1 Programming Manual for C and COBOL (H06.26+, J06.15+)

Host Variables in C/C++ Programs
HP NonStop SQL/MX Release 3.2.1 Programming Manual for C and COBOL663854-005
3-33
Numeric Data
printf("SQLCODE after insert - 3 is %d\n", SQLCODE);
EXEC SQL COMMIT WORK;
printf("\nSQLCODE after COMMIT WORK is %d\n\n", SQLCODE);
return 0;
Assigning Floating-Point Data Types
A column in an SQL/MX format table declared with a floating-point data type is stored
in IEEE floating-point format, and all computations on it are done assuming that. In
addition, all computations performed in MXCI, either on SQL/MX or SQL/MP tables,
use IEEE floating-point format.
A column in an SQL/MP format table declared with a floating-point data type is stored
in Tandem floating-point format, and all computations on it are done assuming that.
NonStop SQL/MX provides an option to store SQL/MP floating-point data in host
variables in IEEE floating-point format. The difference between IEEE and Tandem
floating-point format is seen in the storage, precision, and implementation for the
formats. Input and output via host variables can be treated as IEEE or Tandem floating-
point format.
If you use NonStop SQL/MX to perform computations on a floating-point column in an
SQL/MP table, the result is in IEEE format.
For dynamic queries in embedded SQL programs, the default is Tandem floating-point
format.
For static queries in embedded SQL programs, the input and output depend on the
type of host variables that are declared. This table summarizes the use of IEEE and
Tandem floating points for host variables:
Restrictions for Floating-Point Format
You cannot declare both IEEE and Tandem floating-point host variables in an
application program.
You cannot use the IEEE floating-point format on hardware that does not support
the format.
Embedded SQL/C
Host Variable
Is the -o option
used during
compilation?
Translated C/C++
Declaration for Host
Variables
Generated Definition
in Module Definition
File
float No
*
float (Tandem) REAL
double No
*
double (Tandem) DOUBLE PRECISION
float Yes
**
float (IEEE) REAL_IEEE
double Yes
**
double (IEEE) DOUBLE_IEEE
*
Default for TNS/R-targeted compilations
**
Default for TNS/E-targeted compilations