FIND Statements

These statements are similar to GET and GET’NEXT statements except that they only operate on the index. They do not transfer any data. They are used to traverse or position the internal pointer into a specific index, after which you can use GET'NEXT or GET'PREV statements to access the data sequentially from that point.

FIND #channel, isam’key(knum) rel kval, retkey

FIND’NEXT #channel, retkey

FIND’PREV #channel, retkey

Retkey is a variable which will receive the located key (if the operation is successful). The variable should be of the correct size and type to match the specified index.

For the FIND statement, the fstatvar status variable (from the OPEN statement) can be set to any of the values listed in the table of status values with the OPEN statement, except for ISAM_NA. (Since it doesn't try to read the data record, it cannot get a record-locked status).

For the FIND'NEXT and FIND'PREV statements, the only possible values to be returned for fstatvar are ISAM'NF (meaning you hit the end of the index) or ISAM'EQ (found).

Examples:

FIND #CUS'CH, ISAM’KEY(1) >= "BIG", RET’KEY

FIND’NEXT #CUS'CH, RET'KEY

FIND’PREV #CUS'CH, RET'KEY