Processing records by index and updating can result in a loop;
Moderate
Closed - Fixed
Found:2002.20.35 14 OCT 2004
Fixed:2002.20.36 03 JUN 2004
DETAILS
Updating a record during a PROCESS RECORD ... INDEXED BY ... can result in a
loop because the index entry is rewritten to the end of the index being
processed.
EXAMPLE PROGRAM
retrieval update
process record employee indexed by name via ("Mary Black")
compute salary = salary + 1
write name salary
end record
end retrieval
WORKAROUND
If the index is UNIQUE then the EXIT REC workaround will work but otherwise
only the first matching record will be updated before the EXIT REC.
For non unique indexes you could process the indexed records twice, the
first time just counting how many records there are (no updating) then the
second process records would do the EXIT RECORD once that many records had
been processed.