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



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


-----Original Message-----
From: Winkler, Marty [mailto:MWinkler@xxxxxxxxx] 
Sent: Friday, November 21, 2003 08:05
To: midrange-l@xxxxxxxxxxxx
Subject: Re: Two reade loops: which one preferred ?

Why not do the following?  Isn't this very clear?
PRDkey        SETLL     somefile                           
              DOU       %EOF(somefile)                     
PRDkey        READE     somefile                           
              IF        NOT %EOF(somefile) and       
         ---do stuff--                       
              END                  
              ENDDO             

Marty         

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.