Purpose: SUBSTITUTE replaces all or specified occurrences of one string with another string.
S/UBSTITUTE/ {ALL; line1 [:line2]} "newstring" "oldstring"
ALL |
specifies that all lines are affected by this editing command. |
line1 |
is the line to be affected by this editing command or the first line when a range of lines is to be affected. |
line2 |
is the last line when a range of lines is to be affected. |
newstring |
specifies a character or string of characters that is to replace all occurrences of oldstring in the specified range. |
oldstring |
is a character or string of characters that is to be replaced by newstring. |
In this example, the user discovers that instead of using the TOT field in lines 620 and 630, he should have used the SUM1 field. With SUBSTITUTE, the user instructs ACCENT R to substitute SUM1 for each occurrence of TOT in these two lines. The SUBSTITUTE command displays changed lines after the substitution has been made.
--P579:630
00590 DETAILS SECTION
00600 OLDTOT TO TOT
00610 TOT - AMT_PAID TO CUR_AMT
00620 IF TOT > 100
00630 TOT/10 TO TOT
--620:630 "SUM1""TOT"
00620 IF SUM1 > 100
00630 SUM1/10 TO SUM1
NOTES: The delimiters for newstring and oldstring can be pairs of quotation marks (" "), number signs (# #), dollar signs ($ $), or slashes (/ /).