|
Um, why not avoid this whole silly eof/not eof/middle of file/end of file/SETGT/REDPE/SETLL stuff and simply do: eval :nextseq = 1 /SQL Select :nextseq = max(seq#)+1 from memo where account = :account /END-SQL write memo If the write fails do it again. -Walden ------------ Walden H Leverich III Tech Software (516) 627-3800 x11 WaldenL@xxxxxxxxxxxxxxx http://www.TechSoftInc.com Quiquid latine dictum sit altum viditur. (Whatever is said in Latin seems profound.) -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Tony Carolla Sent: Wednesday, August 24, 2005 7:51 PM To: RPG programming on the AS400 / iSeries 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.