LENS function

Syntax

LENS (dynamic.array)
CALL -LENS (return.array, dynamic.array)
CALL !LENS (return.array, dynamic.array)

Description

Use the LENS function to return a dynamic array of the number of display positions in each element of dynamic.array. Calculations are based on character length rather than display length.

Each element of dyamic.array must be a string value. The characters in each element of dynamic.array are counted, and the counts are returned.

The LENS function includes all blank spaces, including trailing blanks, in the calculation.

If dynamic.array evaluates to the null value, 0 is returned. If any element of dynamic.array is null, 0 is returned for that element.

If NLS is enabled, use the LENSDP function to return a dynamic array of the number of characters in each element of dynamic.array in display positions.