FIND Command

The FIND command creates a temporary select-list of file items to be processed by the next TCL or INFO/ACCESS statement, or by other processors such as the Editor, mvBASIC, or PROC. Creating a select-list is a useful way to define and operate on a subset of items in a database. FIND locates file items that contain a specified string.

Format

FIND [DICT] filename "string" [(I)]

Parameter(s)

DICT

Specifies the file dictionary.

filename

Name of the file.

string

Sequence of characters for which you want to search. Enclose string in double quotes. string can be present in any attribute of a file item.

I

Lists the item-IDs of the selected items on the terminal.

Description

The FIND command creates a temporary select-list containing the item-IDs of items that contain the specified character string. The items referenced by the select-list is processed by the next command you execute.

CAUTION

Only the statement immediately following the FIND statement has access to the select-list. In other words, you must use the select-list immediately, or you lose it!

To permanently save the select-list, use the SAVE-LIST command. Once a select-list is saved, you can retrieve it at any time with the GET-LIST command.

You can also enter the FIND command immediately following a SELECT or SSELECT statement. This allows you to create a select-list from a subset of the items in an existing select-list.

A select-list can reference data in any file, not just the file specified in the original FIND statement. If two files have similar items with the same item-IDs, you can create a select-list from one file, then use it to operate on items from the other file.

Selecting Items that Contain a Specified String

Assume you want to find out the name of the author of a book. You cannot remember the book’s full title, but you know it contains the word SIMPSON. A file called CARD-CATALOG contains the titles and authors of the books. You could enter:

>FIND CARD-CATALOG "SIMPSON"

2 ITEMS SELECTED.  

>LIST CARD-CATALOG AUTHOR TITLE

 

 

 

PAGE   1

 

15:31:38  dd mmm yyyy

 

 

 

CARD-CATALOG.

AUTHOR........

TITLE.................

 

 

 

017650

SIMPSON,R.J.

SIMPSON'S TRADE TIPS

105432

ERICKSON,L.M.

SIMPSON'S LAST HURRAH

 

 

 

2 ITEMS LISTED.

 

 

>

 

 

You can now identify the desired book from the selected items.