• Subject: Re: what is unclear - LEAVE
  • From: "Simon Coulter" <shc@xxxxxxxxxxxxxxxxx>
  • Date: Fri, 08 May 98 18:11:35 +1000

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 

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.

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


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 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].