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-2
C Host Variable Data Types
struct employee { /* structure */
unsigned short empnum;
char first_name[16];
char last_name[21];
unsigned short deptnum;
unsigned short jobcode;
} employee_info;
...
EXEC SQL END DECLARE SECTION;
C Host Variable Data Types
You must explicitly declare all host variables used in SQL statements. A host variable
used in an SQL statement must be declared in an SQL Declare Section prior to the first
use of the host variable in an SQL statement. Only variables of the types recognized
by the 3GL preprocessor can appear within an SQL Declare Section.
To declare a C host variable, specify one of these data types:
Character Host Variables
char [char-set] C-identifier [l + 1] [C-initial-value] [,...]
specifies the data type of a target host variable for a column of this SQL data type:
CHAR[ACTER] [(l)]
char-set is specified as CHARACTER SET [IS] character-set-name. This
optional clause specifies the character set to be associated with the host variable.
If no char-set is specified, the default character set for char is ISO88591.
char-set can be ISO88591, UCS2, KANJI, KSC5601. Note that you can use host
char [char-set] C-identifier [l + 1]
| NCHAR C-identifier [l + 1]
| VARCHAR [char-set] C-identifier [l + 1]
| NCHAR VARYING C-identifier [l + 1]
| {[signed] | unsigned} NUMERIC (p, s)
| PIC[TURE] [S]9(l-s)V9(s) COMP
| {[signed] | unsigned} DECIMAL (l, s)
| PIC[TURE] [S]9(l-s)V9(s)
| {[signed] | unsigned} short
| {[signed] | unsigned} long
| long long
| float
| double
| DATE
| TIME [(n)]
| TIMESTAMP [(n)]
| INTERVAL [period1[(n)] | SECOND [(n[,m])]] [TO
period2[(m)]]