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-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
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.
l A positive integer that represents the length.
s A positive integer that represents the scale of the number.