You are here: Commands > Find

Find

Use the Find command to move directly to the first record containing a specified character search key in an indexed file.

Find allows you to locate a specific record. You can then display or perform calculations on its contents or compare the contents of one record to that of another.

If the search key value is found, Analyzer positions the file at that record. If it is not found, Analyzer displays the message “No index matched key” and the file is positioned at the first record with a search key value greater than the value you specified.

Note: The Find command is the Find Literal option of the Search command. To use the Search command, select Analyze from the menu and choose Search. See Search for details.

This command can be issued in command mode only, although the Search option in the Analyze menu also provides access to Find. For more information, see Issuing Commands.

Prerequisites

The table must be indexed on at least one character key field in ascending order. The Find command does not operate on the portions of the index key fields which are non-character or in descending order.

Command Mode Syntax

FIND character-search-key

character-search-key indicates the value of the key to be found. The character-search-key must match the case of the value to be found. It cannot contain leading blanks and cannot be surrounded by quotes. It can be shorter than the index key, in which case Find only compares the index key value up to the length of the search-key and positions the file at the first matching or next greater record.

The operation of the search is not affected if the Exact Character Comparisons preference is turned on.

Examples

You can use the Find command to move to the first record in an inventory file, indexed on product description, whose product description begins with LATEX.

Enter FIND LATEX on the command line. Analyzer displays the first record in the file whose product description begins with the search key, LATEX.