OVERLAY ( target , position , length , type ) = expressionThe name of a CHARACTER field or variable, or a LONGCHAR variable, that you want to overlay with the expression.An integer expression that indicates the first position in the target where you want to overlay the expression. The value of the position must be positive. If the position is longer than the target, ABL pads the target with blanks to match the position.An integer expression that indicates the number of positions you want to allocate for the storage of the expression. The expression is truncated or padded with blanks to match length. If you do not use the length argument or specify -1 as the length, OVERLAY uses the entire expression.A character expression that directs ABL to interpret the specified position and length values as character units, bytes, or columns. A double-byte character registers as one character unit. By default, ABL interprets the specified position and length values as character units.
Note: If the target is a LONGCHAR expression, "CHARACTER" is the only valid type.A CHARACTER or LONGCHAR expression that results in a character string you want to overlay on the target. If you specify the length, the expression is truncated or padded with blanks to match the length.The r-replc1.p procedure 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.
The SUBSTRING and OVERLAY statements use the length option differently. For both, the length indicates how much of the target to replace. However, SUBSTRING always inserts the full expression and never pads the expression to match the length. By contrast, the length in OVERLAY determines how much ABL adds to the target, even if ABL must truncate the expression or pad it with spaces. See the r-sub-over.p procedure for an illustration the differences between these two statements.
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates. |