Try OpenEdge Now
skip to main content
ABL Reference
ABL Syntax Reference : LENGTH statement
 

LENGTH statement

Changes the number of bytes in a raw variable.

Syntax

LENGTH ( variable ) = expression
variable
A variable of type RAW.
expression
An expression that returns an integer.

Example

This procedure takes the number of bytes in the name stored in the variable r1 and truncates it to 2 bytes:
r-rawln1.p
/* You must connect to a non-OpenEdge demo database to run this procedure */
DEFINE VARIABLE r1 as RAW NO-UNDO.

FIND Customer NO-LOCK WHERE Customer.CustNum = 29.
r1 = RAW(Customer.Name).
LENGTH(r1) = 2.

Notes

*If variable is the Unknown value (?), it remains the Unknown value (?).
*If expression is greater than the number of bytes in variable, the AVM appends null bytes so that the length of variable equals the length of expression.