[Info-vax] Indexed RMS file question
J Xenu
j_xenu at hotmail.com
Fri Oct 2 12:04:21 EDT 2009
It's been a LONG time since I used indexed RMS files on VMS.
I have some data that I wish to place in an RMS indexed file, that is to be
accessed randomly using keys. The way I see it, there will be 3 or 4 keys.
Two will be text, of fixed length, with duplicates allowed. The other one or
two are integer, more on these later.
The lookups will be one of three methods:
1) Read a record that matches the first text key. Simple enough.
2) Read a record that matches both text keys. I want to read a record matching
both the first and second keys. There may be more than one matching record,
if so, I want to access them in order.
3) Using the first text key and an integer key, I want to read any record that
matches the first key and the integer falls within the range of the third
key.
Best described with an example: Assume the file has the content as follows:
(I'll leave out the second key since it's not relevant now)
Key 1 Key 3 Data
Alpha 1-18 data
Alpha 19-72 more data
Beta 1-10 bla bla
Beta 11 more stuff
Beta 12-32 even more data
Beta 33-50 This is the data I want
Beta 68-100 xxx
Gamma 1 yyy
Gamma 2-140 zzz
Assume I do a read with Key 1 = "Beta" and Key 3 = 42. I want the read to
return the record with data = "This is the data I want" since key 1 matches
and Key 3 falls within the range 33-50. How do I define the keys, especially
Key 3 without creating a duplicate record for each possible key3 value?
The ranges are pseudo-random, not multiples of anything. There can be gaps as
well, (for example "Beta", 62 in the example)
More information about the Info-vax
mailing list