You are here: Commands > Locate

Locate

Use the Locate command to move to a specified record number or to the first record in a file meeting a specified condition.

Note: The Locate command is the Locate Record and Locate If command options of the Search command. To access the Search command, select Tools from the menu and choose Search. For more information, see Search.

Locate is usually much slower in finding a specific record than the Find Literal option of the Search command because Locate reads the file sequentially. However, unlike the Find Literal option, Locate does not require the file to be indexed first. The search always starts at the first record (unless you specify the While or Next parameters in the command) and does not rely on any predefined key fields. The processing speed is proportional to the size of the file and the location of the record in it.

Locate Record is often used as a fast way of moving to a specific record number in a fixed record length file. You can also include the Next and While parameters in a Locate command.

Parameters

The Locate command has the following command parameters: If, First, Next, and While. For a description of these parameters, see Command Parameters.

Command Mode Syntax

LOCATE <IF test> <WHILE test> <FIRST|NEXT range>¿

LOCATE RECORD n¿

Note: The number n is the record number to be located.

Examples

To locate the first inventory item beginning with the word PLYWOOD in an inventory file sorted by product description, use Locate. Because the file is sorted on the product description, all such items are grouped together, facilitating a quick analysis of plywood products.

Enter the following into the Command Log text box:

LOCATE IF PRODDESC = 'PLYWOOD'

The Command Log indicates the first record number that meets the condition.