Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

LENGTH OF

Format


LENGTH OF identifier-1


Syntax rules

  1. LENGTH OF identifier-1 can be specified at any point in the PROCEDURE DIVISION where a numeric literal is permitted. This includes subscripts and reference modifiers.

  2. identifier-1 must not be subject to reference modification.

  3. If identifier-1 is a table element then it is not necessary to specify a subscript. If the subscript is specified then the compiler simply evaluates the format

    Since the value of the subscript is not relevant for the evaluation of the length, the compiler simply determines whether the sequence is correct within the expression and whether identifier-1 is defined. The data type is not checked.

  4. identifier-1 must not be defined using the ANY LENGTH clause.

General rules

  1. LENGTH OF represents the length of identifier-1 in characters.

  2. LENGTH OF identifier-1 is a constant which is calculated at compilation time. If identifier-1 is a table with a variable number of elements, then the upper threshold for the OCCURS clause is used to calculate the constant LENGTH OF identifier-1.

    Since the length of the data described with the ANY LENGTH clause is not known until runtime, the only way to determine the length is to use the FUNCTION LENGTH clause.

    The usage of LENGTH OF is suggestive only in combination with USAGE DISPLAY or USAGE NATIONAL.