Previous Topic Next topic Print topic


Determining Equivalent SQL and PL/I Data Types

The base SQLTYPE and SQLLEN of host variables are determined according to the following table. If a host variable appears with an indicator variable, the SQLTYPE is the base SQLTYPE plus one.

PL/I Data Type SQLTYPE of Host Variable     SQLLEN of Host Variable     SQL Data Type
BIN FIXED(n), n < 16 500 2 SMALLINT
BIN FIXED(n), 16 ≤ n ≤ 31     496 4 INTEGER
DEC FIXED(p,s) 484 p (byte 1)

s (byte 2)

DECIMAL(p,s)
BIN FLOAT(p), 24 ≤ n ≤ 52 480 8 FLOAT
CHAR(n), 1 ≤ n ≤ 254 452 n CHAR(n)
CHAR(n) VARYING, 1 ≤ n ≤ 4000 448 n VARCHAR(n)
CHAR(n) VARYING, n > 4000 456 n LONG VARCHAR

The following table can be used to determine the PL/I data type that is equivalent to a given SQL data type.

SQL Data Type PL/I Equivalent Notes
SMALLINT BIN FIXED(15)  
INTEGER BIN FIXED(31)  
DECIMAL(p,s) DEC FIXED(p) or DEC FIXED(p,s)     1 ≤ p ≤ 31 and 0 ≤ s ≤ p
FLOAT BIN FLOAT(p) 24 ≤ p ≤ 52
CHAR(n) CHAR(n) 1 ≤ n ≤ 254
VARCHAR(n)     CHAR(n) VAR 1 ≤ n ≤ 4000
LONG VARCHAR CHAR(n) VAR 4000 < n
DATE CHAR(n) 10 ≤ n
TIME CHAR(n) 8 ≤ n
TIMESTAMP CHAR(n) 26 ≤ n
Previous Topic Next topic Print topic