The SCALARVARYING option is used in the input and output of VARYING strings.
|
When storage is allocated for a VARYING string, the compiler includes a 2-byte prefix that specifies the current length of the string. For an element varying-length string, this prefix is included on output, or recognized on input, only if you specify SCALARVARYING for the file.
When you use locate mode statements (LOCATE and READ SET) to create and read a data set with element VARYING strings, you must specify SCALARVARYING to indicate that a length prefix is present, since the pointer that locates the buffer is always assumed to point to the start of the length prefix.
When you specify this option and element VARYING strings are transmitted, you must allow 2 bytes in the record length to include the length prefix.
A data set created using SCALARVARYING should be accessed only by a file that also specifies SCALARVARYING.
SCALARVARYING and CTLASA must not be specified for the same file, as this causes the first data byte to be ambiguous.