|
CHAIN sets the %found indicator. You'd have something like Key chain file If %found Dou %eof ... process Key reade file Enddo Endif That effectively hides the intention of the loop (%found in one place %eof in another). I think the setll/reade/dow is a mentally "cleaner" approach. It also brings back the discussion of "use chain for single reads; use setll/reade for multiple reads". Loyd -----Original Message----- From: Vern Hamberg [mailto:vhamberg@xxxxxxxxxxxxxxxxxxxxxxxxx] Sent: Friday, November 21, 2003 11:37 To: Midrange Systems Technical Discussion Subject: RE: Two reade loops: which one preferred ? OK, I'm doing C these days and haven't done free-form RPG. Is CHAIN gone? Why the SETLL-READE combination, when CHAIN is equivalent? Key chain file Dow not %eof ...do whatever Key reade file Enddo .... Vern At 10:41 AM 11/21/2003 -0600, you wrote: >In this case, you've removed a read, but complicated the code with multiple >exit conditions. In this code: > >Key setll file >Key Reade file >Dow not %eof >...process record... >Key reade file >Enddo > >There is an additional read, but only one exit condition (and exit condition >check). The loop is executed 0 or more times. > >In your example, you must code two exit conditions because of the DOU. The >code is executed 1 or more times. > >Like Jon said, a priming read determines if there is any data in the file to >process. With DOW, we know immediately whether we should continue processing >the file. With the DOU, we don't know if there's data to process until we're >in the loop; hence, two exit conditions. > >Loyd Goodbar
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.