A locate mode output statement (see LOCATE statement) specifying a varying length string transmits a field having a length equal to the maximum length of the string. For VARYINGZ strings, the null terminator is also transmitted. For VARYING strings, a 2-byte prefix denoting the current length of the string is also transmitted; for this, the SCALARVARYING option of the ENVIRONMENT attribute must be specified for the file.
A move mode output statement (see WRITE statement and REWRITE statement) specifying a varying length string variable transmits only the current length of the string. For VARYINGZ strings, the null terminator is also transmitted. For VARYING strings, a 2-byte prefix is included only if the SCALARVARYING option of the ENVIRONMENT attribute is specified for the file.
Reading and writing using varying length strings allows you to access records that can have undefined or unknown lengths.