FIND

FIND locates a string of text in the file.

Read syntax diagramSkip visual syntax diagram Find previous_searchargsearcharg

Operands

searcharg
specifies the text string to be searched on. If you do not specify searcharg, a search is performed on the previous search string (previous_searcharg).

Return codes

0
Normal return
202
Invalid operand
223
Search argument not found

Example

'FIND REDT'

This example finds the first occurrence of REDT.

'FIND Redt'

If CASE is set to RESPECT then this example will not find the first occurrence of REDT. It will find the first occurrence of Redt. For more information, see the CASE command, CASE.

The searcharg can contain the arbitrary character, in which case the arbitrary character represents any text string which might be imbedded at the arbitrary character's location.

'FIND ONE.THREE'

This example finds the first occurrence of any string with ONE and THREE joined by another string.

Note:
  1. When the RESPECT flag is set with the CASE command, the case of the searcharg is respected.
  2. The search begins at the current line and continues downward until BOTTOM OF DATA is reached, or a match is made. If BOTTOM OF DATA is reached without a match, then the current line remains where it was before the FIND was processed, rather than making BOTTOM OF DATA the current line.