|
>Date: Fri, 16 Jun 2000 14:41:23 +0530 >From: "Dileep Mahi" <dileep.mahi@wipro.com> > >My code follows the following logic > >DOU end of file. >Read the file. >If record is valid. >Search for matching record in some other file. >If search is successful, update records in file. >EndDo > >My Problem is, after EOF, the same loop is getting executed again from the >start but only with the updated records and obviously the records are >getting updated for the second time again. This goes on and on and my >program never ends. Dileep, the most common source of this error is that you are changing a key in the file to a higher value. This causes the record to be selected again. For example, if you start out with keys 1 2 3 and during processing you add 10 to the key, giving 11 12 13 you will encounter records with keys 1,2,3,11,12,13,21,22,23 ... This happens because when you finish with key 3, you ask for the record with the key after 3, which is the one with key 11. The key could be a key in any logical file that is sharing the access path. For example, say LF1 has keys K1 and K2, and LF2 only has key K1, and they are sharing the access path. If you are using LF2, changing either K1 or K2 will change the access path even though LF2 doesn't have K2 as a key. You can find out if the access path is shared by doing DSPFD on the logical file and checking the "File owning access path". One way to avoid this error is to process the file in arrival sequence (not keyed) when you are updating keys. Barbara Morris +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.