Editing rules for PL/I varying length string types

Fields with the PL/I VARYING attribute (VC, VD, and VB) are separated into two fields for File Manager processing. The first field is the current string length field (named "len" in File Manager Headings), and is followed by a second field that contains the string data to be displayed. Each of the string types has the current string length displayed as a FIXED BIN(15) field.

The separated “len” fields created by File Manager for varying strings do not need creation attributes, as the data content determines the “len” value.

In Edit mode, the data string field maximum display width is divided into unprotected characters, up to and including the current length, and a protected area beyond the current length in a non-display mode. VD strings require two character positions for each double-byte value declared for the string, and two character positions for each current length value that is unprotected. BIT strings require one character position in the Edit panel for each bit value in the string. Character positions beyond the current string length are in protected non-display mode for VD and VB types.

The maximum string length for these string types can be declared as a constant or as varying by specifying a REFER variable name that is present in the structure. If declared with a REFER variable for maximum string length, then each record can have different starting positions and data string display widths for that field and any following fields. REFER variables may also be present in the structure to define the bounds or extents of variables declared as dimensioned arrays.

The Edit processing rules for a VARYING field are:

  • The length field of a varying string can be changed to a value in the range 0 to the maximum declared length for the field in that record.
  • If the length is decreased, then the data string is truncated to the new length and the remaining display positions are protected from entry.
  • If the length is increased, appropriate initialization occurs up to the new current length.
  • To change the maximum length of a string variable that uses a REFER value, that REFER value must be changed first and the ENTER key pressed to reset the maximum string length. If the new maximum set by the REFER value is less than the current length of the data string, the data string is truncated and the current length is highlighted as a field in error.