2 Sort Statements and Functions
The parameter is:
If the workfile already contains pointers (indicated by REC greater than 0), only the data entries specified by the pointers in the workfile are checked by the condition parameter. Pointers to data entries that meet the condition criteria are retained in the workfile; all other pointers are deleted.
Since FIND handles record pointers in the data base, and since other users may be modifying the data base, care should be taken when using FIND while the data base is opened in mode 1.
Specifying FIND ALL is the same as FIND 1=1, and is useful to get all records in unsorted order. If a subsequent FIND or SORT BY is used, however, the FIND ALL is not needed and only wastes time. If a FIND, SORT BY, or PRINT # has previously been done, FIND ALL has no effect except to reset the record pointer to record 1.
There are two miscellaneous items concerning FIND. The first is that executing a FIND resets the workfile pointer (as determined by REC) to 1. The second is that if FIND is reading the data base via pointers in the workfile and deletions have occurred in sets involved in the FIND, then FIND will delete the logical workfile records containing pointers to empty data set records.
NOTE: If the condition parameter does not use values from a particular set in the thread (via an IN DATA SET statement), execution time can be improved by deacticating the IN DATA SET statement using the FREE option.
Some examples sequences using FIND are:
FIND TRIM$(Order_no$)>"1000" FIND (Vendor_no>250) AND (Invoice_no>10000) FIND ALL