|
On Mon, 2005-08-22 at 14:23 -0400, Paul Morgan wrote:
> Rich,
>
> ReadExample();
> DoW MoreRecords();
> // ...
> ReadExample();
> EndDo;
>
> But this gets away from your coding of the one function to control the DoW
> loop.
>
> Paul
Right. I'm a DOW-er, and this is the principal construct I use to read
records. Been doing it that way since 1985. It's simple, it works, it
doesn't have extra logic or comparisons.
read example;
dow not %eof example;
// process
read example;
enddo;
The downside is that you have to duplicate the 'read' in two places and
I think this chafes on some folks, and is probably why some prefer the
DOU construct.
It seems that many of the other languages I have used use the 'read
return success' method I have proposed.
In perl, as an alternative language example, the DBI construct is:
while ($row_ref = $sth->fetchrow_hashref) {
// process record
}
In C, the 'fread' function returns the number of items it successfully
read.
>From a big picture perspective, it seems that returning a positive
result for success is quite logical.
I hope that if we ever get a %read bif, it will return true if a record
was successfully read.
Regards,
Rich
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.