Previous Topic: FIND Browse CommandNext Topic: Syntax Rules


Syntax

FIND parameter-string col-delimiter indicator limit-parameter

where parameter-string represents one of the parameters described in this list.

Asterisk (*)

Searches for the same string used when you last issued the FIND command

Example: FIND *

Note: FIND * is functionally equivalent to the RFIND command described later in this chapter.

Quoted string

Searches for a string that includes special characters or blanks

Enclose the text string in either single or double quotation marks.

Example: FIND "go to"

The example, FIND '*', finds an asterisk.

Hexadecimal string

Searches for a string of hexadecimal characters enclosed in single or double quotation marks

Example: FIND X'00'

Specify only hexadecimal characters (0–9 and A–F), and specify an even number of characters.

Specify the hexadecimal identifier X before or after the hexadecimal string of characters (enclosed in quotation marks).

Example: FIND "FFFF"X

Picture string

Searches for a character or string represented by one or more of the following placeholders:

= equal sign

any single character

@ at sign

alphabetic characters

# pound sign

numeric characters

$ dollar sign

special characters

¬ logical not

non-blank characters

. period

invalid display characters

- minus sign

non-numeric characters

< less than

lowercase alphabetic characters

> greater than

uppercase alphabetic characters

Specify the picture string identifier P before or after the picture string of characters (enclosed in quotation marks).

Examples:

FIND P'.' Finds any invalid display character

FIND P'###' Finds 3-digit numbers, but not A23

FIND '@1'P Finds A1, B1, but not A2, B3, and so on

Text string

Represents a text string that is not case-sensitive

You can specify the text string identifier T before or after a text string of characters (enclosed in quotation marks).

Example:

FIND T'Total'

Finds the text strings TOTAL, Total, and total, and TOTALS, Totals, and totals, and so on

You can omit the text string identifier T as shown in the example. This version of the FIND command works the same as the simple FIND command. (FIND T'This' and FIND This are functionally the same.)

This version of FIND disregards case as it performs the search, The result is that 'This', 'THIS', and 'this' are treated the same.

Character string

A case-sensitive text string

You can specify the text string identifier C before or after the text string of characters (enclosed in quotation marks).

This version of FIND performs a search that recognizes the differences in case. The result is that 'This', 'THIS', and 'this' are treated as three different text strings.

Example:

FIND C'Total' Finds only the text strings Total and Totals, but not TOTAL, total, TOTALS, totals

Where col-delimiter (in the preceding syntax) represents a single column or a set of optional columns to search for a text string:

The following results are achieved depending on how you specify column numbers.

Do not specify column numbers

Searches every complete record in the member

Example:

FIND DATE Finds all instances of 'DATE' in all records

Specify a single column number

Searches only that single column in the member

Example:

FIND P'=@1' 1

Finds labels .A1, .B1, .C1, and so on, in the first column of every record

Specify a couple of column numbers, separated by a space

Searches only those columns in the member between those you specified (inclusive)

Example:

FIND '.'P 73 80

Finds invalid characters only in columns 73–80

Where indicator (in the preceding syntax) represents an optional navigation and restriction parameter that allows you to specify the direction to search or restrict the number of instances you want to find. These parameters are summarized in this table.

NEXT

Finds the next instance of the text string you specify, either from the current cursor position (if the cursor is shown in the contents of a member) or from the top of the member (if the cursor is not shown in the contents of a member)

Example: FIND A365 NEXT

You do not have to specify NEXT, because text is searched in this direction by default.

PREV

Finds the previous instance of the text string you specify based on the cursor:

Example: FIND 2365 PREV

FIRST

Finds the first instance of the specified text string, searching:

Example:

FIND P'.' 73 80 FIRST

Finds the first instance of an invalid display character between columns 73 and 80

LAST

Finds the last instance of the text string you specify, from the last record in a member until the text string is found, or until the first record in the member is reached

Example:

FIND '.'P LAST Finds the last instance of an invalid display character anywhere

ALL

Finds all instances of the text string you specify, from the first record in a member until all text strings are found, or until the last record is reached

Example:

FIND '.'P ALL Finds all instances of an invalid display character in all columns

If more than one instance of the text string you specify is found, the total number is displayed, the first text string found is highlighted, and the cursor is placed on its first character.

Where limit-parameter represents an optional parameter that allows you to restrict a search to only specific characters at the beginning or end of a word, any characters within a word, or only a complete word, as summarized in the following list.

CHARS

Searches for any instance of a text string within a word

Example:

FIND DO CHARS

Finds DO, DON'T ADO, ADOPT, 'DO', (DON'T), and ADO

PREFIX

Searches for specific instances of a text string at the beginning of a word only

Example:

FIND DO PREFIX

Finds only DO, DON'T, 'DO', and (DON'T), but not ADO, ADOPT, and ADO

SUFFIX

Searches for specific instances of a text string at the end of a word only

Example:

FIND DO SUFFIX

Finds only ADO, 'DO', and ADO-, but not DO, DON'T, ADOPT, and (DON'T)

WORD

Searches for a complete word only

Example:

FIND DO WORD

Finds only DO and 'DO', but not DON'T, ADO, ADOPT, (DON'T), and ADO-