Datatype descriptions and correspondences

Open ServerConnect supports a subset of Client-Library and DB-Library datatypes. Table 2-9 lists those datatypes and their Gateway-Library equivalents.

Table 2-9: Open ServerConnect datatypes

Open ServerConnect datatype and COBOL data descriptions

Client-Library/C and DB-Library datatypes

Datatype descriptions

TDSBINARY 01 BINVAL PIC X(1) 01 BINVALMAX PIC X(255)

CS_BINARY DBBINARY

Fixed binary type. No translations are performed on this datatype.

TDSCHAR 01 CHARVAL PIC X(1) 01 CHVALMAX PIC X(255)

CS_CHAR DBCHAR

1- to 255-byte fixed character type. TDSCHAR can be used to represent Japanese characters as well as alphabetic characters.

TDSDATETIME 01 DATTIM PIC X(8)

CS_DATETIME DBDATETIME

8-byte datetime datatype. The number of days since 1/1/1900, and the number of 300ths of a second since midnight.

TDSDATETIME4 01 DATTIM4 PIC X(4)

CS_DATETIME4 DBDATETIME4

4-byte datetime datatype. The number of days since 1/1/1900, and the number of minutes since midnight.

TDSFLT4 01 FLT4VAL PIC S9(4) COMP-1

CS_REAL DBREAL

4-byte single precision type.

TDSFLT8 01 FLT8VAL PIC S9(9) COMP-2

CS_FLOAT DBFLT8

8-byte double precision type.

TDSGRAPHIC 01 GRAPHVAL PIC X(254) or 01 GRAPHVAL PIC G(127)

(Not applicable)

1- to 127-character fixed character type. Used at the mainframe only to represent Japanese double-byte characters.

TDSIMAGE 01 IMAGEVAL PIC X(1) 01 IMGVALMAX PIC X(32000)

CS_IMAGE DBIMAGE

Sybase image datatype. A variable-length field that can hold from 0 to 2,147,483,647 bytes of binary data. This is a Sybase datatype and can be used only with column data being returned to Sybase clients.

TDSINT2 01 INT2VAL PIC X(2) or 01 INT2VAL PIC S9(4) COMP

CS_SMALLINT DBSMALLINT

2-byte integer. Can be declared as numeric or character. When declared as numeric, it has a maximum value of 65,525.

TDSINT4 01 INT4VAL PIC X(4) or 01 INT4VAL PIC S9(9) COMP

CS_INT DBINT

4-byte integer. Can be declared as numeric or character. When declared as numeric, it has a maximum value of 2,147,483,648.

TDSLONGVARBIN 01 LONGBINVAL PIC X(1) 01 LBINVALMAX PIC X(32000)

CS_LONGBINARY

Long variable binary. The default maximum length for this datatype is 32K. Does not include the 2-byte (“LL”) length specification prefix. No translations are performed on this datatype.

TDSLONGVARCHAR 01 LONGCHARVAL PIC X(1) 01 LCHARVALMAX PIC X(32000)

CS_LONGCHAR

Long variable character type. The default maximum length for this datatype is 32K. Does not include the 2-byte (“LL”) length specification prefix.

TDSMONEY 01 MONEY-GROUP 05 MON-HI PIC S9(9) COMP 05 MON-LO PIC S9(9) COMP or

01 MONEYVAL PIC X(8)

CS_MONEY DBMONEY

8-byte double precision type. The range of legal values for this datatype is: -$922,337,203,685,477.5807 to +$922,337,203,685,477.5807. Note: This datatype can be used with client data only.

TDSMONEY4 01 MONEY4VAL PIC X(4)

CS_MONEY4 DBMONEY4

4-byte double precision type. The range of legal values for this datatype is: -$214,748.3648 to +$214,748.3647 Note: This datatype can be used with client data only.

TDSNUMERIC 01 NUMVAL 05 PRECISION PIC X(1) 05 SCALE PIC X(1) 05 ARR PIC X(33)

CS_NUMERIC

Numeric type. Support for numbers with: Precision – the precision of the numeric value (1 to 77, default 18). Scale – the scale of the numeric value (0 to 77, default 0).

Note: This is a Sybase datatype. This datatype can be used for client data only.

TDS-PACKED-DECIMAL 01 PDECVAL PIC S9(N) V9(M) COMP-3

CS_PACKED370

IBM/370 packed decimal type. 31-byte precision is supported. Note: This is a mainframe datatype and can be used for mainframe data only.

TDS-SYBASE-DECIMAL 01 NUMVAL 05 PRECISION PIC X(1) 05 SCALE PIC X(1) 05 ARR PIC X(33)

CS_DECIMAL

Decimal type. Support for numbers with: Precision – the precision of the numeric value (1 to 77, default 18). Scale – scale of the numeric value (0 to 77, default 0).

Note: This is a Sybase datatype. This datatype can be used for client data only.

TDSTEXT 01 TEXTVAL PIC X(1)

01 TEXTVALMAX PIC X(32000)

CS_TEXT DBTEXT

Sybase text datatype. A variable-length field that can hold from 0 to 2,147,483,647 bytes of binary data. This is a Sybase datatype, and can be used only with column data being returned to Sybase clients.

TDSVARYBIN 01 VARBIN-GROUPVAL 05 VBIN-LEN PIC S9(4)COMP 05 VBIN-VAL PIC X(1) 01 VARBIN-GROUPVALMAX 05 VBMAX-LEN PIC S9(4)COMP 05 VBMAX-VAL PIC X(255)

CS_VARBINARY DBVARYBIN

1- to 255-byte variable binary type. The field length is stored in a 2-byte (“LL”) prefix, as in DB2. No translations are performed on this datatype.

TDSVARYCHAR 01 VARCHAR-GROUPVAL 05 VCHAR-LEN PIC S9(4) COMP 05 VCHAR-VAL PIC X(1) 01 VARCHAR-GROUPVALMAX 05 VCMAX-LEN PIC S9(4) COMP 05 VCMAX-VAL PIC X(255)

CS_VARCHAR DBVARYCHAR

1- to 255-byte variable character type. The field length is stored in a 2-byte (“LL”) prefix, as in DB2. TDSVARYCHAR can be used to represent Japanese characters as well as alphabetic characters.

TDSVARYGRAPHIC

(Not applicable)

1- to 255-byte graphic datatype. Used to represent Japanese double-byte characters. The field length is stored in a 2-byte (“LL”) prefix, as in DB2. Note: This is a mainframe datatype and can be used with mainframe data only.

TDSVOID

(Not applicable)

NULL or nonexistent parameter. Used to denote parameters omitted in stored procedures. For example, in the following RPC: exec rpc a, b, , d, e The missing c parameter is represented as TDSVOID. No translations are done on this datatype.