![]() ![]()
|
OVERLAY statement
Inserts content from a specified expression into a field or variable replacing existing characters, bytes, or columns.
Syntax
targetpositionlengthtype
A character expression that directs ABL to interpret the specifiedpositionandlengthvalues as character units, bytes, or columns. A double-byte character registers as one character unit. By default, ABL interprets the specifiedpositionandlengthvalues as character units.There are three valid types: "CHARACTER," "RAW," and "COLUMN." The expression "CHARACTER" specifies character units. The expression "RAW" specifies bytes. The expression "COLUMN" specifies display or print character-columns. If you specify the type as a constant expression, ABL validates the type specification at compile time. If you specify the type as a non-constant expression, the AVM validates the type specification at run time.Note: If thetargetis a LONGCHAR expression, "CHARACTER" is the only valid type.expressionExampleThe
r-replc1.pprocedure lets you search for, and replace text strings in a paragraph in a window. When you run the procedure, you see the paragraph, which is an array with an extent of five. You also see a prompt. Enter the text string you want the system to search for, and the new text you want in its place. The procedure searches the paragraph, one line at a time, for the text you entered. The procedure uses the OVERLAY statement to replace the string of old text with the string of new text. The procedure also determines the length of the old text and the new text.
Notes
- The SUBSTRING and OVERLAY statements use the
lengthoption differently. For both, thelengthindicates how much of thetargetto replace. However, SUBSTRING always inserts the fullexpressionand never pads theexpressionto match thelength. By contrast, thelengthin OVERLAY determines how much ABL adds to thetarget, even if ABL must truncate theexpressionor pad it with spaces. See the r-sub-over.p procedure for an illustration the differences between these two statements.- Do not split double-byte characters. This statement allows you to overlay either the lead or trail-byte of the target string when you specify "RAW" as the
typeparameter.See also
![]() |
OpenEdge Release 10.2B
|
![]() ![]()
|