|
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 +---
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.