|
On 3/7/2016 10:22 AM, Wilson, Jonathan wrote:
firstkey setll file
do until %eof
firstkey reade file
if %eof
leave
endif
...do stuff...
enddo
I like this a lot, because it also allows for this:
firstkey setll file
do until %eof(file)
firstkey reade file
if %eof(file)
leave
endif
if SkipCondition
iter
endif
...do stuff...
enddo
I can insert a skip condition and if I don't want to process the record, I can just ITER to go get the next record. Also, I always put the filename in my %EOF. It may be overkill, but I've gotten into the habit.
Note that you can also put a check in prior to the loop to check for no records if that's an error condition:
firstkey setll file
if not %equal(file)
...no records, log error, exit...
endif
do until %eof(file)
Joe
As an Amazon Associate we earn from qualifying purchases.
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.