It's my vacation and I'm thinking odd things about RPG I/O. In
particular, I'm trying to work out just READE really works.
The documentation says it "retrieves the next sequential record ... if
the key of the record matches the search argument".
Now I've never thought really deeply about this, but I'm thinking that,
in essence, it sets %eof if the NEXT record in key order does not match
the search argument - I have tried this and believe I confirmed this. It
doesn't jump to a matching record farther along, even if it exists.
Here is some sample data and code to demonstrate this.
The CHAIN finds the record with values 1, 2, 1 - since it exists.
The 1st READE finds a record, since the NEXT record has key 1, 2.
The 2nd READE sets %eof because, although a record exists with key 2, 2
- it isn't the NEXT record in key sequence.
As I say, I've never tried this - there may not even be a reason to do
so, but I've done some curious things in my life. At any rate, it seems
that the behavior is, in essence, to READ the next record and check for
equality - not that it actually does it that way, it is just how it
seems to come out.
Comments are welcome. I know I might be over-simplifying things, but the
way things work down low may differ from what is the perceived result.
Happy New Year, y'all!
Vern
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.