Previous Topic: &LBLSTR

Next Topic: &LOCK


&LENGTH

Returns a number indicating the length of the supplied variable or constant.

&LENGTH { variable | constant }

&LENGTH is a built-in function and must be used to the right of an assignment statement. The character length value of the target variable is returned in the variable to the left of the assignment statement.

Operands:

variable | constant

A variable or constant.

Examples: &LENGTH

&A = ABCDEF       -* assigns a value to &A 
&LEN = &LENGTH &A -* &LEN is assigned a value of 6

Notes:

&LENGTH is used to determine the length of a string before attempting to use &SUBSTR to extract the right hand part of that string. The &SETLENG statement is used to set a variable to a specific length.

If &CONTROL DBCS or DBCSN or DBCSP is in effect, &LENGTH is sensitive to the presence of DBCS data.

More information:

&LENGTH