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


  • Subject: Re[2]: what is unclear - LEAVE
  • From: ericadelong@xxxxxxxx
  • Date: Fri, 08 May 98 09:31:37 -0500


Simon,

With all due respect (and ready to duck) :), I don't see how any extra tests 
have been avoided. You explicitely test EOF condition on Loop. IMO, EOF 
conditions should be treated as a logical EXCEPTION, not necessarily a logical 
condition. By using the LEAVE to manage EOF exceptions, your looping logic can 
focus on the real conditions you are testing.

JMHO
Eric A DeLong
ericadelong@pmsc.com

______________________________ Reply Separator _________________________________
Subject: Re: what is unclear - LEAVE 
Author:  <MIDRANGE-L@midrange.com > at INTERNET
Date:    5/8/98 6:11 PM


Hello Paul,
     
The priming read isn't sloppy; it's a standard design pattern.  It avoids the 
extra IF test (inside the loop) to 
cope with EOF which means half as many tests in your loop construct.  For 
example:
     
C        *IN90        DOUEQ        *ON
C                READ        FORMAT                                        90 
C        *IN90        IFEQ        *OFF
 *                do stuff
C                ENDIF
C                ENDDO
     
Of course many of the list members would code that as:
     
C        *IN90        DOUEQ        *ON
C                READ        FORMAT                                        90 
C  90                LEAVE
 *              do stuff
C                ENDDO
     
But you still get the unnecessary extra test.
     
I used to code this way until I measured the cost of the extra tests over 
millions of records.  Changing to the 
the priming read and a DOW saved many minutes in a job where those saved minutes
counted.  Now it's habit.
     
Regards,
Simon Coulter.
     
//---------------------------------------------------------- 
// FlyByNight Software         AS/400 Technical Specialists 
// Phone: +61 3 9419 0175      Mobile: +61 3 0411 091 400
// Fax:   +61 3 9419 0175      E-mail: shc@flybynight.com.au 
// 
// Windoze should not be open at Warp speed.
     
     
//--- forwarded letter ------------------------------------------------------- 
> Date: Thu, 07 May 98 21:51:11 -0400
> From: "PaulMmn" <PaulMmn@ix.netcom.com> 
> To: MIDRANGE-L@midrange.com
> Reply-To: MIDRANGE-L@midrange.com
> Subject: Re: what is unclear - LEAVE
     
> 
> >(BTW, my preference is a DOW with a priming read, and a read at the bottom 
> >of the loop)
> >
> >Regards,
> >
> >Rick
> 
> 
> It's always struck me as sloppy coding to require 2 reads for the same
> file...   (:  I'm not really sure of what logic I like to eliminate this 
> 'priming read,' but I know I don't like that extra read.
> 
> 
> --Paul E Musselman
> PaulMMn@ix.netcom.com
     
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. 
| Questions should be directed to the list owner/operator: david@midrange.com 
+---
     


+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-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.