SQL/MX 3.2 Programming Manual for C and COBOL (H06.25+, J06.14+)

Host Variables in C/C++ Programs
HP NonStop SQL/MX Release 3.2 Programming Manual for C and COBOL663854-002
3-8
Using Corresponding SQL and C Data Types
Table 3-1. Corresponding SQL, C Host Variable Data Types, and Translated C
Declarations for NUMERIC, DECIMAL, PIC, SMALLINT, and LARGEINT Data
Types
SQL Data Type
C Host Variable
Data Type Translated C Declaration
NUMERIC (1 to 4,s) SIGNED NUMERIC (1 to
4,s)
*
short
NUMERIC (1 to 4,s) UNSIGNED unsigned NUMERIC
(1 to 4,s)
*
unsigned short
NUMERIC (5 to 9,s) SIGNED NUMERIC (5 to
9,s)
*
long
NUMERIC (5 to 9,s) UNSIGNED unsigned NUMERIC
(5 to 9,s)
*
unsigned long
NUMERIC (10 to 18,s) SIGNED NUMERIC (10 to
18,s)
*
long long
NUMERIC (10 to 128,s)
UNSIGNED
unsigned NUMERIC
(10 to 128, s)
*
Int16 [ x ]
**
NUMERIC (19 to 128,s)
SIGNED
NUMERIC (19 to
128, s)
*
Int16 [ x ]
**
PIC[TURE] [S] 9(l-s)V9(s)
COMP
Same as NUMERIC
*
Same as NUMERIC
DEC[IMAL] (l,s) SIGNED DECIMAL (l,s)
*
char [l + 2]
DEC[IMAL] (l,s) UNSIGNED unsigned DECIMAL
(l,s)
*
char [l + 2]
PIC[TURE] [S] 9(l-s)V9(s) Same as DECIMAL
*
char [l + 2]
SMALLINT SIGNED short short
SMALLINT UNSIGNED unsigned short unsigned short
INT[EGER] SIGNED long long
INT[EGER] UNSIGNED
unsigned long unsigned long
LARGEINT
long long long long
*
These host variable data types are extensions.
**
x is computed based on precision p.
l A positive integer that represents the length.
s A positive integer that represents the scale of the number.
Note. You can declare an Unsigned Numeric variable and then store a negative BigNum
value. Unsigned Numeric and Signed Numeric binary formats are the same for BigNum values,
with the exception of the sign bit.