If a hit is found then this format of the @ON statement replaces the hit string with a specified string.
Operation | Operands | F mode, L mode |
@ON | { lines | svars } [,...] [:cols[:] ] C HANGE [ A LL] [ F ] [ R ] [ P ATTERN]search [,int] [TO] string [V] |
lines svars | One or more line ranges in which the search is to be performed. One or more ranges of string variables in which the search is to be |
cols | Contiguous column range to which the search is to be limited. If the range specification contains only a single column specification, this If no column range is specified then the column range specified with |
ALL | All the hit strings in a line are replaced by the specified string. If |
F | In each specified line range, strings are only replaced in the first hit line. If |
R | The lines are searched through from right to left. If |
PATTERN search | The wildcards present in the search term are interpreted. Search term that is to be searched for in the search range (for details, see |
int | Only the |
string | String that is to be replaced by the hit string. It is also permissible to specify The string is converted into the character set used by the work file or string |
V | The number of hit lines is stored in the integer variable |
If the replacement would cause a record to exceed the maximum record length of 32768 characters then no replacement is made, message EDT1937
is output and processing is continued.
If the statement is interrupted with [K2] and the EDT session is continued with /INFORM-PROGRAM
then the processing of the statement is aborted and message EDT5501
is output.
Example
The first @ON searches for the third occurrence of the character I
in line 2. This I
is then to be replaced by the string present in columns 19 to 21 of line 1, i.e. STU
.
The second @ON replaces the first occurrence of the string IS
in line 2 with an empty string, i.e. it is deleted (alternative to @ON format 9).