Admin Production rocket
Current Publication

Determining Equivalent SQL and PL/I Data Types

Enterprise Developer for Eclipse (including UNIX Components) V7.0
Rocket® Enterprise Developer (formerly a product of Micro Focus or formerly a product of Open Text) documentation, created before Rocket Software acquired certain products from OpenText, may include outdated references to "Micro Focus" or "OpenText", both of which are trademarks of OpenText or its affiliates. Rocket Software is not affiliated with Micro Focus or OpenText and has since rebranded these products as Rocket® products. You may also encounter outdated links in this documentation. If you do, please contact Rocket Support (support@rocketsoftware.com) for assistance.

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
  • For FLOAT data, only double-word BIN FLOAT is supported.
  • Precisions, where appropriate, must be specified with integer constants. Default values are not provided.
  • The SQLDA include file has %REPLACE statements for the SQL data types.

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