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 PL/1 data description

Client-Library/C and DB-Library datatypes

Datatype description

TDSBINARY

01 BINVAL CHAR(1)

CS_BINARY DBBINARY

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

TDSBIT

01 BITVAL BIT (01)

CS_BIT DBBIT

Single bit type. Used for Boolean values.

Used with PL/1 only; not supported for COBOL. No translations are performed on this datatype.

TDSCHAR

01 CHARVAL CHAR(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 DATTIME CHAR(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 CHAR(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 BINARY FLOAT(21)

CS_REAL DBREAL

4-byte single precision type.

TDSFLT8

01 FLT8VAL BINARY FLOAT(53)

CS_FLOAT DBFLT8

8-byte double precision type.

TDSGRAPHIC

01 GRAPHVAL CHAR(254)

(Not applicable)

1- to-127-character fixed character type.

Used at the mainframe only, to represent Japanese double-byte characters.

TDSIMAGE

01 IMAGEVAL CHAR(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.

TDSINT1

01 INT1VAL CHAR(1)

CS_TINYINT DBTINYINT

1-byte integer.

Used with PL/1 only; not supported for COBOL.

TDSINT2

01 INT2VAL	FIXED BIN(15)

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	FIXED BIN(31)

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	CHAR(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	CHAR(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 MONEYVAL CHAR(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 CHAR(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 NUM_PRECIS  CHAR(1)
    05 NUM_SCALE   CHAR(1)
    05 NUMARR      CHAR(33)

CS_NUMERIC

Numeric 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.

TDS_PACKED_DECIMAL

01 PDECVAL FIXED DEC(15,2)

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 SDEC_VAL
    05 NUM_PRECIS  CHAR(1)
    05 NUM_SCALE   CHAR(1)
    05 NUMARR      CHAR(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 CHAR(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 VARGRAPH
 	05 VARBIN_LL	FIXED BIN(15)
 	05 VARBIN_VAL CHAR(n)

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 VARGRAPH
05 VARCHAR_LL	FIXED BIN(15)
05 VARCHAR_VAL CHAR(n)

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

01 VARGRAPH
05 VARGRAPH_LL	FIXED BIN(15)
05 VARGRAPH_VAL CHAR(n)

(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 performed on this datatype.