Change text
There are two Change Text process statements:
- NCHGT
- Change new (or search) input text string
- OCHGT
- Change old input text string
The relative input file (new
or old
) is
scanned for text that matches a search_string.
If matching text is
found, it is replaced by a corresponding
output_string before the comparison process is performed.
Question marks (?
) may be used as wildcard
characters in the
search_string or output_string.
The search_string and output_string need not be the same length. The output_string may even be a null string.
Compare Types: LINE, WORD, and Search.
OCHGT cannot be used for Search.
- search_string
- A character or hexadecimal string to be replaced in the input file. For one embedded apostrophe, use two consecutive apostrophes ('').
- output_string
- The replacement string to be used in the comparison. For one embedded apostrophe, use two consecutive apostrophes ('').
- start_column
- The column in or after which the search_string must start. Must be greater than zero.
- last_start_column
- The last column in which the search_string may start. Must be separated from the start_column by a colon, and must be equal to or greater than the start_column value. If not supplied, is the equivalent of setting the value to start_column. To search from the start_column to the end of a variable length row, set the last_start_column to a value larger than the length of the longest row.
Example | Description |
---|---|
NCHGT 'ABCD','XXXX' |
Changes all strings ABCDin the new file to XXXXbefore performing the comparison. |
OCHGT 'ABCD','XXXX',1:50 |
Changes all strings ABCDin the old file, that start within columns 1 to 50, to XXXXbefore performing the comparison. |
OCHGT 'ABCD','',1:50 |
Changes all strings ABCDin the old file, that start within columns 1 to 50, to a null string before performing the comparison. (In the comparison process, this effectively ignores any ABCDstrings found in those positions in the old file.) |
NCHGT 'ABCD','AB' |
Changes all strings ABCDin the new file to ABbefore performing the comparison. |
NCHGT X'7B01',':1',6 |
Changes all hexadecimal strings X'7B01' in the new file,
that start in column 6,
to the character string :1before performing the comparison. |
NCHGT 'PREF???','NPREF' |
Changes all 7-character strings with the prefix
PREFin the new file, to the 5-character string NPREFbefore performing the comparison. |
NCHGT 'PREF???','NPREF??' |
Changes the first 5 characters of
all 7-character strings with the prefix
PREFin the new file, to NPREFbefore performing the comparison. |