|
If it's the last record in the file then it's setting the EOF thus causing your problem. If the file is keyed by that memo number, why not do a write(e) and catch the duplicate record error, increment the memo number by one each time and loop until it's written. Either that or Setll on the account number and loop till it changes then increment the memo number and write your record. Ron Power Programmer Information Services City Of St. John's, NL P.O. Box 908 St. John's, NL A1C 5M2 709-576-8132 rpower@xxxxxxxxxx http://www.stjohns.ca/ ___________________________________________________________________________ Success is going from failure to failure without a loss of enthusiasm. - Sir Winston Churchill Tony Carolla <carolla@xxxxxxxxx> Sent by: rpg400-l-bounces@xxxxxxxxxxxx 2005/08/24 09:21 PM Please respond to RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> To RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> cc Subject SetGT/ReadPE method Exception I have a account memo file that is uniquely keyed by account# and memo sequence number. When I want to add a record to an account, I do the following: - SetGT using the account number - ReadPE using the account number - If a record was found, add one to the sequnece number - If a record was not found, use 1 as the sequence number - Write the memo with the error extender - If there was a write error, repeat the loop (somebody added a memo during the above steps) So this works beautifully until today -- The account being added to was the last in the memo file. The SETGT fails, 1 is used, and the write fails repeatedly. I am trying to find an efficient way to determine what memo number to add. Perhaps I have to resort to SETLL/READE to the end, add one to the seq#. Any ideas?
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.