|
GA ==> how more cycles (machine-cycles)? I guess that adding an %equal is rather unexpensive. In case of no records a setll and a reade (TWO I/O operations) costs more cycles. Don't laugh: I'm from the generation that were taught to use odd number of digits in packed decimals because it is cheaper. I still do this, because typing a '5' is as easy as typing '4' (and the song about teaching old dogs..). Henrik > From: "G Armour" <garmour400m@xxxxxxxxx> > To: "Midrange Systems Technical Discussion" > <midrange-l@xxxxxxxxxxxx> > Sent: Friday, November 21, 2003 12:41 PM > Subject: Re: Two reade loops: which one preferred ? > > > | Thank goodness for the voice of reason! <g> > | > | Though I wonder, Henrik, why would this cost a few more cycles? I can't > | see logically how one could eat more cycles doing it this way. But, of > | course, this is not a paramount consideration. > | > | GA > | > | --- Henrik Krebs <hkrebs@xxxxxxxxx> wrote: > | > A reason why style #1 might be preferred is that 'Do forever' is > | > misinformational unless you have a veeery large file. > | > > | > But I actually use style #3: > | > ----- Style #3 ------------------------------------------- > | > > | > mykey setll record > | > dou %eof > | > mykey reade record > | > if not %eof > | > ... process ... > | > endif > | > enddo > | > > | > because I think it's cleaner. > | > Why? > | > 1. First of all: Read can return either a) a record or b) an eof flag, > | > and we (you) only want 'process' in case 'record' > | > You could also inside the loop have coded for both situations (select > | > or if..else) > | > 2. It's clean: only a single 'read' to control a 'read-loop'. Both > | > style #1 and #2 has two or three different routes through the code: zero > | > records, a record read and no more records > | > 3. No 'Do forever' that definately is not 'forever' > | > 4. Same construction (the fewer the better) for 'read entire file' > | > (except the missing setll of cause). > | > > | > It might mean a few more cykles, but they are cheaper than programmer > | > time > | > > | > Henrik
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.