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-9
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 (32-
bit Address
Model)
Translated C
Declaration (64-
bit Address
Model)
NUMERIC (1 to
4,s) SIGNED
NUMERIC (1 to
4,s)
*
short short
NUMERIC (1 to
4,s) UNSIGNED
unsigned NUMERIC
(1 to 4,s)
*
unsigned
short
unsigned
short
NUMERIC (5 to
9,s) SIGNED
NUMERIC (5 to
9,s)
*
long int
NUMERIC (5 to
9,s) UNSIGNED
unsigned NUMERIC
(5 to 9,s)
*
unsigned long unsigned int
NUMERIC (10 to
18,s) SIGNED
NUMERIC (10 to
18,s)
*
long long long long
NUMERIC (10 to
128,s) UNSIGNED
unsigned NUMERIC
(10 to 128, s)
*
Int16 [ x ]
**
Int16 [ x ]
**
NUMERIC (19 to
128,s) SIGNED
NUMERIC (19 to
128, s)
*
Int16 [ x ]
**
Int16 [ x ]
**
PIC[TURE] [S]
9(l-s)V9(s) COMP
Same as NUMERIC
*
Same as
NUMERIC
Same as
NUMERIC
DEC[IMAL] (l,s)
SIGNED
DECIMAL (l,s)
*
char [l + 2] char [l + 2]
DEC[IMAL] (l,s)
UNSIGNED
unsigned DECIMAL
(l,s)
*
char [l + 2] char [l + 2]
PIC[TURE] [S]
9(l-s)V9(s)
Same as DECIMAL
*
char [l + 2] char [l + 2]
SMALLINT SIGNED short short short
SMALLINT
UNSIGNED
unsigned short unsigned
short
unsigned
short
INT[EGER]
SIGNED
int long int
*
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.