LENGTH: Determining the Length of a Character String

How to:

The LENGTH function determines the length of a character string, including trailing spaces.

Syntax: How to Determine the Length of a Character String

LENGTH(string)

where:

string

Alphanumeric

Is the character string whose length is to be found, or a temporary field that contains the string.

Example: Determining the Length of a Character String

LENGTH determines the length of a variable in COUNTRY:

MAINTAIN FILE CAR
MODULE IMPORT (MNTUWS)
NEXT COUNTRY INTO STK1
COMPUTE LEN/I3 = LENGTH(STK1(1).COUNTRY);
TYPE "<STK1(1).COUNTRY HAS A LENGTH OF <<LEN"
END

The result is:

ENGLAND HAS A LENGTH OF 10