Skip to main content

STRING

[StringType] STRING[n]

A character string of n bytes, space padded (not null-terminated). If n is omitted, the string is variable length to the size needed to contain the result of the cast or passed parameter. You may use set indexing into any string to parse out a substring.

The optional StringType may specify ASCII or EBCDIC. If the StringType is missing, the data is in ASCII format. Defining an EBCDIC STRING Attribute as a string constant value implies an ASCII to EBCDIC conversion. However, defining an EBCDIC STRING Attribute as a hexadecimal string constant value implies no conversion, as the programmer is assumed to have supplied the correct hexadecimal EBCDIC value.

The upper size limit for any STRING value is 4GB.

Example:

STRING1 MyString := IF(SomeAttribute > 10,'1','0');
        // declares MyString a 1-byte ASCII string

EBCDIC STRING3 MyString1 := 'ABC';
        //implicit ASCII to EBCDIC conversion
 
EBCDIC STRING3 MyString2 := x'616263';
        //NO conversion here

See Also: LENGTH, TRIM, Set Ordering and Indexing, Hexadecimal String