Variable-length character strings (VARCHAR and LONGVARCHAR) are SQL data types with a variable maximum length.
Host Variable Formats
- OpenESQL and DB2 ECM
49 varchar1-len PIC 9(4) COMP.
49 varchar1-data PIC X(200).
49 longvarchar1-len PIC 9(4) COMP.
49 longvarchar1-data PIC X(30000).
01 clob1 SQL TYPE IS CLOB(32K).
- The level number for group items containing only two elementary items must be 49. The first item is a 2-byte field declared
with usage COMP or COMP-5 that represents the effective length of the character string. The length field can be signed or
unsigned. The second item is a PIC X(n) data type, where
n is an integer representing the length of the field that holds the data.
- SQL statements must reference the group name.
- If the data being copied to a SQL CHAR, VARCHAR or LONG VARCHAR data type is longer than the defined length, then the data
is truncated and the SQLWARN1 flag in the SQLCA data structure is set. If the data is smaller than the defined length, a receiving
CHAR data type might be padded with blanks.
clob1 format uses the CLOB SQL TYPE.
- In addition to the definitions valid for both OpenESQL and DB2 ECM, the following definitions are also valid for OpenESQL:
01 varchar2 PIC X(20) VARYING.
01 varchar3 SQL TYPE IS CHAR-VARYING(200).
01 longvarchar1 SQL TYPE IS LONG-VARCHAR(50000).
varchar3 format uses the CHAR-VARYING SQL TYPE.
longvarchar1 format uses the LONG-VARCHAR SQL TYPE.
JVM Managed Runtime
- In addition to the definitions valid for OpenESQL, the following definition is also valid for the OpenESQL
JVM Managed Runtime:
01 varchar6 string.