Kbase P114373: Error 91 with FIND NEXT when it should find the first record.
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  17/03/2006 |
|
Status: Unverified
SYMPTOM(s):
FIND NEXT does not find the first record when there isn't a currently available record.
According to the documentation, FIND NEXT finds the next record in the table that meets the specified characteristics of the record. If no record has been found, FIND NEXT behaves like FIND FIRST.
FIND has been used to retrieve records, but now there isn't a record available. Executing FIND NEXT now results in error 91.
** No record is available. (91)
CAUSE:
A previous FIND has failed with the result that no current record is available. However, an index cursor has been created and the index cursor has been moved to the last record in the table. Subsequently any further FIND NEXT statements results in the ENDKEY condition because Progress attempts to move beyond the last record in the index.
For example:
def var i as integer.
DEFINE VARIABLE lendkey AS LOGICAL INITIAL TRUE NO-UNDO.
do i = 1 to 4 with frame a 6 down:
find next Customer no-lock.
display CustNum Name.
end.
FIND Customer WHERE CustNum <> CustNum NO-LOCK NO-ERROR.
MESSAGE "ERROR : " ERROR-STATUS:ERROR skip
ERROR-STATUS:get-number(1) SKIP
ERROR-STATUS:GET-MESSAGE(1) VIEW-AS ALERT-BOX.
DISPLAY "CLEAR ERROR Flag" WITH FRAME b NO-ERROR.
REPEAT ON ENDKEY UNDO, LEAVE:
/* raises endkey */
FIND NEXT Customer NO-LOCK. /* Replace with FIND PREV to prove */
lendkey = FALSE.
LEAVE.
END.
DISPLAY CustNum Name lendkey ERROR-STATUS:ERROR with frame d NO-ERROR.
FIX:
Use FIND FIRST instead of FIND NEXT to retrieve the first record in the index.