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



The logic seems OK to me.  You could use reade in the loop, but you're doing
the equivalent thing in the control statement.  

If you wrapped the whole thing up in a procedure that returned an indicator
value, the code would be easier to read.  I've been doing that a lot lately
in situations where I need to check several conditions before doing
something to avoid deeply nested if statements.  Something like if (procA
AND procB AND procC).  In this case the procedure would end either when you
get a match or you know there are no matches and return the found condition.


> -----Original Message-----
> From: Jim Langston [mailto:jimlangston@conexfreight.com]
> Sent: Friday, December 08, 2000 4: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 thread ...


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.