X 1.1.3.3 LENGTH OF
X The LENGTH OF special register contains the number of bytes used by an
X identifier.
X LENGTH OF creates an implicit special register whose content is equal to
X the current byte length of the data item referenced by the identifier.
X Note: For DBCS data items, each character occupies 2 bytes of storage.
X LENGTH OF can be used in the Procedure Division anywhere a numeric data
X item having the same definition as the implied definition of the LENGTH OF
X special register can be used. The LENGTH OF special register has the
X implicit definition:
X USAGE IS BINARY PICTURE 9(9)
X If the data item referenced by the identifier contains the GLOBAL clause,
X the LENGTH OF special register is a global data item.
X The LENGTH OF special register can appear within either the starting
X character position or the length expressions of a reference modification
X specification. However, the LENGTH OF special register cannot be applied
X to any operand that is reference-modified.
X The LENGTH OF operand cannot be a function, but the LENGTH OF special
X register is allowed in a function where an integer argument is allowed.
X If the LENGTH OF special register is used as the argument to the LENGTH
X function, the result is always 4, independent of the argument specified
X for LENGTH OF.
X LENGTH OF can not be either of the following:
X A receiving data item
X A subscript
X When the LENGTH OF special register is used as a parameter in a CALL
X statement, the parameter must be a BY CONTENT parameter.
X When a table element is specified, the LENGTH OF special register contains
X the length, in bytes, of one occurrence. When referring to a table
X element, it need not be subscripted.
X A value is returned for any identifier whose length can be determined,
X even if the area referenced by the identifier is currently not available
X to the program.
X A separate LENGTH OF special register exists for each identifier
X referenced with the LENGTH OF phrase, for example:
X MOVE LENGTH OF A TO B
X DISPLAY LENGTH OF A, A
X ADD LENGTH OF A TO B
X CALL "PROGX" USING BY REFERENCE A BY CONTENT LENGTH OF A
X Note: The number of bytes occupied by a COBOL item is also accessible
X through the intrinsic function LENGTH (see "LENGTH" in topic 7.1.20).
X LENGTH supports nonnumeric literals in addition to data names.