findstate

FIND statement [name] defined without qualifier [ FIRST | LAST | NEXT | PREV | CURRENT ]


Rule "findstate" gives this warning when it finds a "FIND" statement without [ FIRST | LAST | NEXT | PREV | CURRENT ] while the WHERE clause does not appear to select a unique index, and if there is no 'IF AMBIGUOUS' statement immediately following.


This rule does not look at temp-tables: those are inspected by rule "findstate-tt".

The risc:

The WHERE clause does not contain enough fields to bracket all fields in a unique index. If the FIND statement returns more than one record an error will occur when an attempt to access the record is made. Also, if not already searching on an Unique index, without the qualifier the PROGRESS engine will look to see if there is another record that matches the criteria increasing the search time.


Known issue:

The IF AMBIGUOUS statement may not directly follow the find statement but it could be in the code before the record is accessed.


How to solve this:

Use more fields in the WHERE clause or check the data dictionary to find out which fields are in a unique index. Make a habit of adding IF AMBIGUOUS immediately after the find statement.


How to suppress these warnings: