FIND command

Searches an indexed character field for the first value that matches the specified character string.

Note

The FIND command and the FIND( ) function are two separate Analytics features with significant differences. For information about the function, see FIND( ) function.

Syntax

FIND search_value

Parameters

Name Description
search_value

The character string to search for.

search_value is case-sensitive and cannot include leading spaces.

Do not enclose the value in quotation marks unless quotation marks are part of the data being searched.

Examples

Searching for a specific value

You want to locate the first value in the Card_Number character field that exactly matches or starts with "8590124".

First you index the Card_Number field in ascending order. Then you run FIND:

INDEX ON Card_Number TO "CardNum" OPEN
SET INDEX TO "CardNum"
FIND 8590124

Remarks

Note

For more information about how this command works, see the Analytics Help.

When to use FIND

Use the FIND command to move directly to the first record in a table containing the specified search_value in the indexed character field.

INDEX requirement

To use the command, the table you are searching must be indexed on a character field in ascending order.

If multiple character fields are indexed in ascending order, only the first field specified in the index is searched. The command cannot be used to search non-character index fields, or character fields indexed in descending order.

Partial matching

Partial matching is supported. The search value can be contained by a longer value in the indexed field. However, the search value must appear at the start of the field to constitute a match.

FIND output depending on match

The FIND command produces one of the following results, depending on whether the search value is found:

  • search value is found the first matching record in the table is selected
  • search value is not found the table is positioned at the first record with a greater value than the search value

    If there are no values in the indexed field greater than the search value, the table is positioned at the first record. In both cases, the message "No index matched key" is displayed.

The FIND command is not affected by the Exact Character Comparisons option (SET EXACT ON/OFF).

ACL Scripting Guide 14.1