LENGTH statement
- Last Updated: January 18, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
Changes the number of bytes in a raw variable.
Syntax
|
- variable
- A variable of type RAW.
- expression
- An expression that returns an integer.
Note: You
can use compound assignment operators (
+=, -=, *=, /=) with the LENGTH statement. For more
information, see += Addition assignment operator, -= Subtraction assignment operator, *= Multiplication assignment operator, and /= Division assignment operator.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
|
The following example code uses the
*= assignment operator to double the number of bytes for
the variable.
|
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.