× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Tony,

Try changing your %FOUND to %EOF.  The %Found condition is set off by the SETGT 
operation.  The READPE sets %EOF when it reads the last records not %FOUND.  
Checking %FOUND as you are doing below will fail and use 1 as your sequence 
number because it is using the results of the SETGT operation.  The READPE 
isn't failing, the results just aren't being checked.

This will only happen at the end of the file because the SETGT operation will 
always find a record for all other points in the file and %FOUND will be on.

HTH,

Rick

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Tony Carolla
Sent: Thursday, August 25, 2005 10:20 AM
To: RPG programming on the AS400 / iSeries
Subject: Re: SetGT/ReadPE method Exception


Well, then I must be running into a different bug. As far as I knew, if the
key value supplied to SETGT is greater than or equal to the highest key
value, %FOUND is not turned on, and the file cursor is not repositioned. If
it were always repositioned, then apparently %FOUND would always be on, in
contradiction to what is in "The Modern RPG VI Language, Third Edition",
page 355. The code I am using below repeats endlessly if the account number
(represented by CI.Family# and CI.Member#) is the highest value in the file.
I have verified the error data and found that the key value it attempts to
replace (Mmseq#) is 1, while the account in question has two memos, sequence
1 and 2.

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;

On 8/25/05, Rich Duzenbury <rduz-midrange@xxxxxxxxxxxxxxxxxxx> wrote:
>
> Just to be sure, I ran it in debug.
>
> With the test code I presented, *every* record is added to the end of
> the file.




--
"Enter any 11-digit prime number to continue..."
"In Hebrew SQL, how do you use right() and left()?..." - Random Thought
"If all you have is a hammer, all your problems begin to look like nails"
--

Privileged and Confidential.  This e-mail, and any attachments there to, is 
intended only for use by the addressee(s) named herein and may contain 
privileged or confidential information.  If you have received this e-mail in 
error, please notify me immediately by a return e-mail and delete this e-mail.  
You are hereby notified that any dissemination, distribution or copying of this 
e-mail and/or any attachments thereto, is strictly prohibited.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.