|
Jim, I haven't done a full review of this code snippet, but at first glance it looks like if you get a nohit you loop until EOF. On a no match you force a read but do not test for current value > search argument to exit the read loop. So if your file has 1000 entries and ask for entry 101, which does not exist, you will read the remaining 899 entries before exit. Maybe I missed something. Jim Langston wrote: > Well, yes, but there is no logical file with EqId, EqNo and RefB as the key. > > And since this system is maintained by someone else, I didn't think it would > be a good idea to just add a logical without good cause. > > Regards, > > Jim Langston > > Wanda Gigger wrote: > > > > I would create a foreign key (keylist) with the key being EqId, EqNo, RefB. > > Then I would chain to that key... > > keylist CHAIN filename > > IF %found > > (your code) > > ENDIF > > -----Original Message----- > > From: owner-rpg400-l@midrange.com [mailto:owner-rpg400-l@midrange.com]On > > Behalf Of Jim Langston > > Sent: Friday, December 08, 2000 6:15 PM > > To: RPG400-L@midrange.com > > Subject: DoU... > > > > I am writing a new program, and one of the things I am trying to do is > > to see if a record already exists. The Key for this record has the > > Equipment Number (in 2 parts, EqId and EqNo) and Entry date. > > > > What I am actually looking for is the record with the same equipoment > > number and the existing RefB (Customer Refernace Number) matching. > > > > This is the way I'm doing it, and obviously after this code I am going > > to have to do a If FoundMatch = *On, or to put a call to a subroutine > > just before, or after, the Eval FoundMatch = *On. > > > > It's not, IMO, real clean code. I seem to think it can be streamlined a > > bit. I am only reading the records with the same container number as I > > use a SetLL and my DoU will fail when the container doesn't match. > > > > Any suggestions? All comments welcome. > > > > C Eval FoundMatch = *Off > > C CCOHD_Key SetLL OHdRc > > C Read OHdRc > > C DoU FoundMatch = *On > > C Or %Eof(OHdRc) > > C Or EQEqId <> RXEqId > > C Or EqEqNo <> RXEqNo > > > > C If %Trim(OHBL#) = %Trim(RXInv#) > > C Eval FoundMatch = *On > > C Else > > C Read OHdRc > > C EndIf > > > > C EndDo > > > > Regards, > > > > Jim Langston +--- | 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.