The data types specified in ODBC APIs are defined in terms of ODBC C types in the API definitions. Use the COBOL data declarations that correspond to the indicated ODBC C types of the arguments.
| ODBC C type | COBOL form | Description |
|---|---|---|
| SQLSMALLINT | COMP-5 PIC S9(4) | Signed short integer (2-byte binary) |
| SQLUSMALLINT | COMP-5 PIC 9(4) | Unsigned short integer (2-byte binary) |
| SQLINTEGER | COMP-5 PIC S9(9) | Signed long integer (4-byte binary) |
| SQLUINTEGER | COMP-5 PIC 9(9) | Unsigned long integer (4-byte binary) |
| SQLREAL | COMP-1 | Floating point (4 bytes) |
| SQLFLOAT | COMP-2 | Floating point (8 bytes) |
| SQLDOUBLE | COMP-2 | Floating point (8 bytes) |
| SQLCHAR | POINTER | Pointer to unsigned character |
| SQLHDBC | POINTER | Connection handle |
| SQLHENV | POINTER | Environment handle |
| SQLHSTMT | POINTER | Statement handle |
| SQLHWND | POINTER | Window handle |
The pointer to an unsigned character in COBOL is a pointer to a null-terminated string. You define the target of the pointer item as PIC X(n), where n is large enough to represent the null-terminated field. Some ODBC APIs require that you pass null-terminated character strings as arguments.
Do not use System z host data formats. ODBC APIs expect parameters to be in native format.