|
On Thu, 2005-08-25 at 08:20 -0700, Tony Carolla wrote: > The only possibility is that > 1) The SetGT is failing, due to there being no greater key values > 2) The ReadPE is failing, due to the failure of the positioning > 3) Sequence 1 is used. The only way sequence 1 would be used (assuming there > is no sequence zero, and I verified this) is this. > > Dou Not %Error; > > // Find next memo seq# for member > SetGT(E) (CI.Family#:CI.Member#) Mmemo_I; > ReadPE(E) (CI.Family#:CI.Member#) Mmemo_I MI; > > If %Found(Mmemo_I); > MO.Mmseq#=MI.Mmseq#+1; > Else; > MO.Mmseq#=1; > EndIf; > > Write(E) Mmorec MO; > EndDo; The problem is that you are doing your setgt and readpe inside the loop. It resets the sequence number back to 1, and then when you write again, you still get the same error. // Find next memo seq# for member SetGT(E) (CI.Family#:CI.Member#) Mmemo_I; if %error // whatever endif; ReadPE(E) (CI.Family#:CI.Member#) Mmemo_I MI; if %error // whatever endif; Dou Not %Error; If %Found(Mmemo_I); MO.Mmseq#=MI.Mmseq#+1; Else; MO.Mmseq#=1; EndIf; Write(E) Mmorec MO; EndDo; Note that this is not quite production quality. What if an error occurs that is not simply a duplicate key error? What if all the sequence numbers are used? Regards, Rich
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.