Open ClientConnect datatypes are designed to match the corresponding DB2 datatypes. For example, CS_VARCHAR is the same as the DB2 datatype VARCHAR, which is different from the Adaptive Server VARCHAR. The following subsections describe each Open ClientConnect datatype in detail:
Open ClientConnect supports the following three binary types:
CS_BINARY is a binary type.
CS_VARBINARY is a variable-length binary type. It corresponds to the DB2 datatype VARBINARY, the DB-Library datatype DBVARYBIN, and the Gateway-Library datatype TDSVARYBIN, and includes a length specification (the initial two bytes, referred to in print as “LL”) along with the data.
CS_LONGBINARY is a long variable binary type. It does not include the two-byte “LL” length specification prefix. The default maximum length for this datatype is 32K.
CS-VARBINARY does not correspond
to the Adaptive Server datatype varbinary. Open ClientConnect converts
Adaptive Server varbinary data to CS-VARBINARY.
Open ClientConnect supports the following three character types:
CS_CHAR is a set-length character type.
CS_VARCHAR is a variable-length character type. It corresponds to the DB2 datatype VARCHAR, the DB-Library datatype DBVARYCHAR, and the Gateway-Library datatype TDSVARYCHAR, and includes a length specification (the initial two bytes, referred to in print as “LL”) along with the data.
CS_LONGCHAR is a long variable-length character type. It does not include the two-byte “LL” length specification prefix.
CS-VARCHAR does not correspond
to the Adaptive Server datatype varchar. Open ClientConnect converts
Adaptive Server varchar data to CS-VARCHAR.
Open ClientConnect supports the following two datetime types that hold 8-byte and 4-byte datetime values, respectively:
CS_DATETIME corresponds to the Adaptive Server datatype. The range of legal CS-DATETIME values is from January 1, 1753 to December 31, 9999, with a precision of 1/300th of a second (3.33 milliseconds).
CS_DATETIME4 corresponds to the Adaptive Server datatype. The range of legal CS_DATETIME4 values is from January 1, 1900 to June 6, 2079, with a precision of 1 minute.
Open ClientConnect supports the following two integer types:
CS_SMALLINT is a 2-byte integer.
CS_INT is a 4-byte integer.
Open ClientConnect supports the following five decimal types:
CS_REAL is a 4-byte decimal value.
CS_FLOAT is an 8-byte decimal value.
CS_PACKED370 is used to handle IBM S/370 packed decimal data. It can be converted to the Adaptive Server numeric, or Sybase-decimal datatype with CSBCONVERT.
CS_PACKED370 values can be negative. The maximum number of decimal places for a packed decimal object is 31.
CS_NUMERIC is used to handle Adaptive Server numeric data. It can be converted to character or packed decimal, as in the following example:
DCL 01 NUMDEC, 05 Precision CHAR(1), 05 Scale CHAR(1), 05 APR CHAR(33)
CS_DECIMAL is used to handle Adaptive Server numeric data. It can be converted to character or packed decimal. It is defined the same way as CS_NUMERIC.
Open ClientConnect supports the following two money datatypes that hold 8-byte and 4-byte money values, respectively:
CS_MONEY corresponds to the Adaptive Server datatype. The range of legal CS_MONEY values is +/- $922,337,203,685,477.5807.
CS_MONEY4 corresponds to the Adaptive Server datatype. The range of legal CS_MONEY4 values is between -$214,748.3648 and +$214,748.3647.