Choose the appropriate unit of measure
- Last Updated: February 11, 2026
- 2 minute read
- OpenEdge
- Version 13.0
- Documentation
Several ABL elements, including the LENGTH function, OVERLAY statement, SUBSTRING function,
and SUBSTRING statement, let you specify the unit
of measure as the character, the byte, or the column. If you choose
the wrong unit of measure, you might split or overlay a multi-byte
character. Consider the following example:
|
|
The example defines a character variable and sets it to a string
of seven characters, the fourth of which is double byte. The example
then overlays a string of four, single-byte characters on the original
string, starting at position one and continuing for four positions.
Unfortunately, the unit of measure is the byte (specified by RAW),
so the fourth byte of the second string, which is the character z,
overlays the fourth byte of the original string, which is the lead
byte of the double-byte character.
The following figure shows how the z in the second string overlays the lead byte of the double-byte character in the original string.

All that remains of the multi-byte character is the trail-byte, as shown in the following figure.

To fix this error, change the unit of measure to CHARACTER,
as shown:
|
|
The corrected program produces the string shown in the following figure.
