|
The %found is going to give you unexpected results. I know from bitter experience with something I put into production. <g> The way I remember it is that anything with a read in it needs %eof. Setll wants %equal, and chain wants %found. %found with setll means it found a record with a key greater than or equal to the lookup value. > -----Original Message----- > From: Jim Langston [mailto:jimlangston@conexfreight.com] > Sent: Monday, December 11, 2000 10:19 AM > To: RPG400-L@midrange.com > Subject: Re: DoU... > > > Thanks, > > With everyone's tips I was able to reduce it to this. > Incidentally, the > first code snippet I sent didn't work and I had to debug it, but the > logic flow was right. This, on the other hand, is a bit more cleaner. > > Being able to specify just a few parts of the key for my key > field is a > new one on me, and very beneficial. I had a heck of a time getting my > original code to work as I was setting the date field to > *LoVal and after > a bit of debugging did I discover that the date was sorted in > *Descending > order. Not having to specify the date in my key means I don't have to > worry about what order it's sorted in now. > > RPG is becoming a lot more cleaner. Good work Hans and Barbara 8-) > > C Eval ContAlpha = Bd_RXEqID > C Eval ContNumber = Bd_RXEqNo > > C Eval FoundMatch = *Off > C CCOHD_Key SetLL OHdRc > C Reade OHdRc > C DoW %Found(CCOHD04) And > C FoundMatch = *Off > C If %Trim(OHRefB) = %Trim(Bd_RXInv#) > C Eval FoundMatch = *On > C Else > C Reade OHdRc > C EndIf > > C EndDo > > C If FoundMatch > C Except FoundOne > C EndIf > > C CCOHD_Key KList > C KFld ContAlpha > C KFld ContNumber > > Scott Mildenberger wrote: > > > > Jim, > > > > Instead of using READ, use READE with a KLIST that only has > the two parts of > > the equipment number. That way, you don't have to check > when you run out of > > records with a matching equipment number. Or you could > define a logical > > with all proper fields to check against and then just do a > SETLL to check > > whether the record already exists. > > > > Scott Mildenberger > +--- > | 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 > +--- > +--- | 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 copyright@midrange.com.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.