[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
Wed Sep 20 20:15:42 EDT 2023
On 9/20/2023 7:53 PM, Arne Vajhøj wrote:
> On 9/20/2023 7:39 PM, Arne Vajhøj wrote:
>> On 9/20/2023 8:22 AM, Simon Clubley wrote:
>>> On 2023-09-20, Arne Vajhøj <arne at vajhoej.dk> wrote:
>>>> On 9/19/2023 11:15 PM, gah4 wrote:
>>>>> On Tuesday, September 19, 2023 at 5:46:29?PM UTC-7, Arne Vajhøj wrote:
>>>>>> open(unit=1,file='rel.dat',status='new',form='formatted',
>>>>>> + organization='relative',recl=512,recordtype='variable',
>>>>>> + access='direct')
>>>>> OP asked about fixed record size, and traditionally that is
>>>>> the way it was done. I haven't followed that detail of later
>>>>> Fortran standards. They have to, at least, allocate to the
>>>>> maximum size.
>>>>
>>>> True.
>>>>
>>>> I added a little more for my example.
>>>>
>>>> If I understand the docs correctly then the above
>>>> allocates 512 bytes (per recl) for each cell, but
>>>> handles actual lengths 0-512 within that cell.
>>>
>>> It allocates 512 bytes for the _data_ within that cell. It then
>>> allocates
>>> a bit more per record to store the length of each record. Look at the
>>> example Hein posted.
>>>
>>> $ set response/mode=good_natured
>>>
>>> Even without your statement about never having used relative files,
>>> at this point I would be actively suspecting that to be the case. :-)
>>>
>>> I _have_ used relative files in the past in a number of cases, but I
>>> have
>>> never, ever, used anything other than fixed length records with them.
>>>
>>> The idea of variable length records within a relative file is utterly
>>> alien to me.
>>
>> Maybe.
>>
>> I could have used fixed:
> ...
>> But the point was to illustrate usage of relative files.
>>
>> The code above is a very poor illustration of relative files.
>>
>> Because there is nothing relative specific in it. The exact same code
>> works fine with:
>> organization='sequential'
>>
>> Direct access for rfm fixed works fine even for org sequential. No need
>> for org relative.
>>
>> Direct access for rfm variable does not work for org sequential only
>> for org relative.
>
> Alternatively I could have used non-existing records
> to illustrate relative.
> which can be done for org sequential but quite as nice:
^not
Arne
More information about the Info-vax
mailing list