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.
The upper size limit for any STRING value is 4GB.
Fields can optionally have a LENGTHSIZE attribute to specify the number of bytes (1, 2, or 4) used to store a variable-length field's length prefix. The default is 4 bytes. This is useful for reducing memory usage for small variable-length strings. If a longer string is assigned, it will be truncated.
Example:
STRING1 MyString := IF(SomeAttribute > 10,'1','0');
// declares MyString a 1-byte ASCII string
EBCDIC STRING3 MyString1 := 'ABC';
//implicit ASCII to EBCDIC conversion
testRecord := RECORD
STRING name;
STRING name1{LENGTHSIZE(1)};
STRING name2{LENGTHSIZE(2)};
STRING name4{LENGTHSIZE(4)};
UNSIGNED1 sentinel;
END;
OUTPUT(MyString);
OUTPUT(MyString1);
See Also: LENGTH, TRIM, Set Ordering and Indexing, Hexadecimal String