The most important thing by using interrecord-functions like peek() or previous() is an appropriate sorting (only possible within a resident load) of the data - in your case probably the fields PLY_COVERNUMBER, PLY_TRANSACTIONTYPE, PLY_VERNO and/or PLY_RENDATE. A very good explanation how it worked is this one: Peek() or Previous() ?