[Info-vax] Indexed RMS file question
Jeffrey H. Coffield
jeffrey at digitalsynergyinc.com
Sat Oct 3 11:19:46 EDT 2009
J Xenu wrote:
> 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)
If you assume that the ranges do not overlap then one approach would be
to create two fields. The first with the Alpha/Beta/Gamma data, the
second with a zero filled string as the end of the range. Make this a
segmented key and then you can do a read key less than or equal to your
Beta, 00062 and get the record you want.
To help more, I would need to know more about the application and what
language you are using.
Jeff Coffield
http://www.digitalsynergyinc.com
More information about the Info-vax
mailing list