Character datatypes

The following sections contain additional information about character datatypes.


TDSVARYCHAR

Always use TDSVARYCHAR rather than TDSVARCHAR. DBVARYCHAR and TDSVARYCHAR objects include a length specification that precedes the data, just like DB2 variable datatypes. The length specification occupies the initial two bytes of the field (in binary format) and is referred to in print as “LL”.

NoteIn Client-Library, the CS_VARCHAR datatype includes the “LL” length specifications and can be mapped to TDSVARYCHAR.


DB2 LONG VARCHAR datatypes

TDSLONGVARCHAR objects do not have the “LL” length specification. Programs using DB2 data can send DB2 LONG VARCHAR data as TDSVARYCHAR, TDSLONGVARCHAR, or TDSTEXT.

Converting to TDSVARYCHAR

If you use TDSVARYCHAR for LONG VARCHAR data, and if the text length is longer than 255 bytes, the data is either truncated or rejected. The truncation/rejection option is set at the TRS when it is started. The mainframe system programmer can override that option during customization.

Converting to TDSLONGVARCHAR

If you convert DB2 LONG VARCHAR data to TDSLONGVARCHAR, remember that this Open ServerConnect datatype does not have the “LL” length specification. Your program should point to the data portion of the declaration only.

NoteIf your client program is Open Client 10.0 or later, you can convert both columns and parameters to TDSLONGVARCHAR. Otherwise, you can use TDSLONGVARCHAR only with columns.

Converting to TDSTEXT

If you convert to TDSTEXT, the complete data string is sent, without truncation.