Rational Developer for System z
COBOL for Windows, Version 7.5, Programming Guide


Using data types appropriate for ODBC

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.

Table 44. ODBC C types and corresponding COBOL declarations
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 zSeries host data formats. ODBC APIs expect parameters to be in native format.

related tasks
Passing pointers as arguments in ODBC calls
Accessing function return values in ODBC calls


Terms of use | Feedback

Copyright IBM Corporation 1996, 2008.
This information center is powered by Eclipse technology. (http://www.eclipse.org)