Print

Print


Aleksandar Donev wrote:
> On Friday 22 June 2007 15:26, Bill Long wrote:
>   
>> BTW, the "usual" implementation for unformatted sequential access
>> is to store the record length before and after the record itself.
>>     
> But it is not possible for a user to find out the length? I guess I could try 
> reading more and more characters into an array until the I/O statement fails? 
> If it is in the file, it seems a pity to me not to be able to read it 
> directly :-\
Ah, but that's only one common implementation.  It's one that came out 
of the minicomputer tradition.  There was a different approach that was 
common in the mainframe tradition.  Instead of recording the length of 
the entire record, it recorded the length of what was only part of the 
record.  Two bits in each partial record were used to determine whether 
a partial record was the beginning of the record, in the middle of the 
record, the end of the record, or both the beginning and end (i.e., the 
entire record).  The entire length of the record could be determined by 
traversing the sequence of partial records that comprised it, but the 
length was not stored in one place.  The advantage of this approach is 
that the maximum record length is not bounded by the number of bytes 
used to store lengths in the file.

-Kurt