There are two process options to search for strings in the input
file:
- SRCHFOR
- Search a text string in the input file
- SRCHFORC
- Search a text string continuation
These statements search for a specified string in the input Search
file. The string may be further qualified as a word, prefix, or suffix,
and where it must be positioned on the line.
SRCHFORC is the continuation of the immediately preceding SRCHFOR
or SRCHFORC process statement. In the case of a SRCHFOR/SRCHFORC group,
all the specified strings must occur on the same line for the search
to be successful.
Compare Type: Search
>>-SRCHFOR--'--string--'--+------+------------------------------>
+-,--W-+
+-,--P-+
'-,--S-'
>--+-------------------------------------------+---------------><
'-,--start_column--+----------------------+-'
'-:--last_start_column-'
>>-SRCHFORC--'--string--'--+------+----------------------------->
+-,--W-+
+-,--P-+
'-,--S-'
>--+----------------------------------------------+------------><
+-,--start_column--+----------------------+----+
| '-:--last_start_column-' |
+-,--+--start_column--+----------------------+-+
| '-:--last_start_column-' |
'-,--+ ----------------------------------------'
- string
- The character or hexadecimal string
to be searched for (enclosed by apostrophes). Use two consecutive
apostrophes ('') for one apostrophe within the search string.
- W
- Word.
String must appear as a separate word. That is, be delimited
by one or more spaces or special characters.
- P
- Prefix.
String must appear as the first part of some other text.
- S
- Suffix.
String must appear as the last part of some other text.
- start_column
- The column in which the string must
start for the search to be successful. (If a last_start_column is
also specified, see description for that operand.)
- last_start_column
- The "latest" column
in which the string can start for the search to be successful. (Must
be separated from the start_column by a colon.)
- +start_column
- The relative column (starting from
the column where the string for the previous SRCHFOR/SRCHFORC was
found) in which the string must start for the search to be successful.
(A corresponding last_start_column operand can be specified
in a similar way to that for the start_column.)
- +
- The
string specified can occur anywhere after the position of the previously
found string for the search to be successful.
- Example
- Description
- SRCHFOR 'ABC'
- Searches for string "ABC"
- SRCHFOR 'ABC',W
- Searches for the word "ABC"
- SRCHFOR X'4004'
- Searches for the hexadecimal string X'4004'
- SRCHFOR 'A''bc'
- Searches for string "A'bc"
- SRCHFOR 'ABC',5:10
- Searches for string "ABC" starting in positions 5 to 10
- SRCHFOR 'ABC',W,5
- Searches for the word "ABC" starting in position 5
- SRCHFOR 'ABC'SRCHFORC 'DEF'
- Searches for strings "ABC" and "DEF" in any order in
the same line.
- SRCHFOR 'ABC'SRCHFORC 'DEF',+
- Searches for the string "DEF" following the string "ABC"
- SRCHFOR 'ABC'SRCHFORC 'DEF',W,+
- Searches for the word "DEF" following the string "ABC"
- SRCHFOR 'ABC'SRCHFORC 'DEF',+5
- Searches for the string "DEF" in the 5th position after the
string "ABC"
- SRCHFOR 'ABC' SRCHFORC 'DEF',+5 SRCHFORC 'GKL'
- Searches for the string "DEF" in the 5th position after the
string "ABC" with the string "GKL" also anywhere in the
same line