LENGTH

LENGTH returns an unscaled REAL FIXED BINARY value specifying the current length of x.

Read syntax diagramSkip visual syntax diagramLENGTH( x)
x
String-expression or an OFFSET reference with the LOCATES attribute and an explicit AREA reference. If x is binary, it is converted to bit string; otherwise, any other conversion required is to character string.

For an example of the LENGTH built-in function, refer to MAXLENGTH.

The BIFPREC compiler option determines the precision of the result returned.

When applied to an OFFSET reference with the LOCATES attribute and implicit AREA qualification:
  • If the OFFSET reference is not null, LENGTH returns the address of the located data.
  • If the OFFSET reference is null, LENGTH returns SYSNULL.