[Info-vax] Example of random access by record number on an RMS fixed record size, relative organization file?
Arne Vajhøj
arne at vajhoej.dk
Thu Sep 21 20:16:33 EDT 2023
On 9/20/2023 10:37 PM, Hein RMS van den Heuvel wrote:
> On Wednesday, September 20, 2023 at 8:07:47 PM UTC-4, Arne Vajhøj wrote:
>> A relative read is:
>>
>> calculate byte offset = record number * record length
>> read record length bytes starting at byte offset from file
>
> Noop.
> Not for RMS. Not even for fixed length record sequential files.
>
> Sequential files are conceptually divided into fixed length Multi Block Count (MBC) time 512 byte buffers.
> For shared file access the first accessor locks in the MBC. Default MBC=16 = 8KB.
> RMS will first take an integer round down to MBC to find the first MBC block to read and finds the record in there.
> It may need a second read if the records spills over the end, even if it could have just started the read later.
>
> For Relative files RMS divides the file up into buckets (default = big enough to hold 1 at least record.
> It first calculates records/bucket (RPB) integer divide of bucketsize*512 and (one (flag byte) plus Maximum Record Size).
> Next calculate VBN as 1 (File Prologue) plus integer divide of record number by RPB times RPB.
> Read BKS * 512 bytes, and locate the record.
My mistake.
VMS read blocks not bytes. And RMS use buffers.
Let me rephrase:
calculate what "chunk" on disk has the data
read that "chunk" into memory and extract data from there
Arne
More information about the Info-vax
mailing list