Thursday, June 19, 2014

SRCHFOR/SRCHFORC

SRCHFOR,SRCHFORC - Search for Strings in the Input Files

SRCHFOR Searches for a text string in the input data set
SRCHFORC Searches for a text string continuation condition

Syntax
SRCHFOR ’string’[,P][,start-colm[:stop-colm]] [,S] [,W]
SRCHFORC ’string’[,P][,start-colm[:stop-colm]] [,S][,+start-colm[:+stop-colm]] [,W][,+]


string                  Character string enclosed within single quotes. For embedded single quotes, use                                            two consecutive single quotes ('').

P Prefix.             String begins a word, but is not the complete word (Example: string “abc” is a prefix to the                           word “abcdef”).

S Suffix.              String ends a word, but is not the complete word (Example: string “def” is a suffix to the                               word “abcdef”).

W Word.            String is a complete word. Words are delimited by blanks, or end-of-line characters.
start-colm           A number that identifies the column in which Search-For begins looking for string. All                                   columns to the left of this column are ignored.

stop-colm          A number that identifies the column in which Search-For ends its search for string, but only                            for that record. If the data set contains more records, the search continues with the next                                record, beginning with the column specified as the start-colm.

+start-colm       The relative column (starting from the column where the string of SRCHFOR/SRCHFORC                           ended) .

+stop-colm        The number that identifies the relative column (starting from the column where the string of                             the  last SRCHFOR/SRCHFORC ended)

* and .* - Comment Lines (Search-For Listing)

An asterisk as the first character on a process statement line begins a printable
comment line. A period-asterisk (.*) as the first two characters on a process
statement line begins a comment that is not printed in the Search-For listing.

* This comment prints in the Search-For listing. Must be in column 1.
.* This comment does not print in the Search-For listing. Must be in columns 1 and 2.

Examples

SRCHFOR ’ABC’                                  Searches for string “ABC” within search columns.
SRCHFOR ’ABC’,W                             Searches for “ABC” as word string.
SRCHFOR X’4004’                               Searches for hex string within search columns.
SRCHFOR ’A’bc’                                  Searches for string “A'bc”.
SRCHFOR ’ABC’,5:10                         “ABC” starts within 5:12 of search columns.
SRCHFOR ’ABC’,W,5                         Word “ABC” starts in column 5.

SRCHFOR ’ABC’ SRCHFORC ’DEF’                              Finds “ABC” and “DEF” on same line within the search columns.
SRCHFOR ’ABC’ SRCHFORC ’DEF’,+                           Finds “DEF” to the right of first “ABC” string.
SRCHFOR ’ABC’ SRCHFORC ’DEF’,+1:9999                Same as above example.
SRCHFOR ’ABC’ SRCHFORC ’DEF’,W,+                      Same as above, but “DEF” must be a word.
SRCHFOR ’ABC’ SRCHFORC ’DEF’,+5                         Same as above, but “DEF” must start in fifth column after “ABC”.
SRCHFOR ’ABC’ SRCHFORC ’DEF’,+5 SRCHFORC ’GKL’ Same as above, but “GKL” must also be
found on the same line.

No comments:

Post a Comment