Search strings in the input file
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
- 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 |
---|---|
|
Searches for string ABC |
|
Searches for the word ABC |
|
Searches for the hexadecimal string X'4004' |
|
Searches for string A'bc |
|
Searches for string ABCstarting in positions 5 to 10 |
|
Searches for the word ABCstarting in position 5 |
|
Searches for strings ABCand DEFin any order in the same line. |
|
Searches for the string DEFfollowing the string ABC |
|
Searches for the word DEFfollowing the string ABC |
|
Searches for the string DEFin the 5th position after the string ABC |
|
Searches for the string DEFin the 5th position after the string ABCwith the string GKLalso anywhere in the same line |