[Info-vax] Indexed file read question
Hein RMS van den Heuvel
heinvandenheuvel at gmail.com
Wed Nov 18 23:50:35 EST 2020
>On Wednesday, November 18, 2020 at 10:02:58 PM UTC-5, abrsvc wrote:
>
> That makes sense. So as I thought I stated: If a read is done using a primary key first then a read using a secondary key, the "starting >point" is the position within the file based upon the first read such that read #2 will return the first record with the matching >secondary key that appears AFTER the first record read rather than the first record in the file that matches the secondary key.
Again, as I wrote before ---- Noop. Incorrect. A keyed record lookup establishes a fresh context.
What part of that do you not understand?
> example. Wouldn't the returned record for the keyed read using the
> secondary key return the aap A record since it is the first in the file
> with the secondary key of A
NOOP. From the example:
$ conver/merge tt: tmp.idx
noot A
vuur B
aap A
Therefor the first record inserted ( BY TIME! ) with key A was 'noot', not ' aap'
The first record - by primary key - is ' aap' but that was not the first alternate key 'A' to be inserted.
Hoff wrote>> Hein is assuming a key search on the secondary key to start the sequential access on the secondary key,
I assume nothing. I simply know how it is. That's a Dutch thing. Much like: https://images.app.goo.gl/QhdvQ7CvxordwGEj6
Key search is NOT sequential search. Sequential access and context is established by either
1) a $REWIND or $CONNECT with KRF=xxx , pointing to the first row by that key, and with duplicates the first (by time) inserted with that first key.
2) a $GET with KRF=xxx, pointing to the first row with alternate key satisfying the key ( KBF,KSZ,RAC)... independent on any other action/context on that stream ($CONNECT)
Hoff>> then switching to and doing sequential $get operations on the secondary
That functionality does NOT exist in RMS
Hoff>> what record might you sequentially $get on the secondary key is indeterminate.
Noop. You'll get the next record by primary key as you cannot switch key context on sequential access as per above.
Cheers,
Hein
More information about the Info-vax
mailing list