The ANY LENGTH clause specifies that the length of a linkage section item may vary at runtime and is determined by the length of the argument.
General Format
ANY LENGTH
Syntax Rules
- The ANY LENGTH clause must be specified only in an elementary level 1 entry in the Linkage Section of a function, of a contained program, or of a method that is not a property method.
- If the source element containing the ANY LENGTH clause is a contained program or is a method, the subject of the entry must be referenced in its PROCEDURE DIVISION header as either
- A formal parameter with the BY REFERENCE phrase, or
- The returning item.
- If the source element containing the ANY LENGTH clause is a function, the subject of the entry must be referenced in its PROCEDURE DIVISION header as a formal parameter with the BY REFERENCE phrase.
- A PICTURE clause must be specified for the subject of the entry, and the character-string specified in the PICTURE clause must be one instance of the picture symbols 'N' or 'X'.
General Rules
- The ANY LENGTH clause specifies that the subject of the entry must be:
- A zero-length item when the corresponding argument or returning item of the activating runtime element is a zero-length item, or
- Treated as though there were
n repetitions of the picture symbol in the character-string in its PICTURE clause, where
n is the length of the corresponding argument or returning item of the activating runtime element.