Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!

Empty Space in Direct Access Files?

Groundsel
Beginner
101 Views

I am ashamed to ask such a trivial question but all the direct access files I have prepared and to which I have written have had occupied records.  I am inclined to prepare one which will have only a few occupied records but whose records will be indexed by the ID's of a much larger collection.  So there will be a lot of empty records never created or read.  My question is "Will there be a lot of wasted space in the file?"  Is there a grid of records for which space is set aside willy-nilly? Or is the method of their creation more ingenious so that space in the file is assigned as records are written?

I began with a search of your database in the hope of saving myself the embarrassment of asking.  But I did not succeed in finding someone else with a similar query.  I can, of course, be more creative with indexing of my own - but this is the simplest way if it does not have wasteful side effects.

0 Kudos
2 Replies
Steve_Lionel
Black Belt Retired Employee
101 Views

All the records, from the first through the highest numbered written, occupy space on disk. A direct access file is just a series of fixed-length records and the system locates them by multiplying the record number by the record length.

So if you write record 1 and record 1000 of a direct-access file with record length of 100 bytes, the file will be 100,000 bytes long.

Groundsel
Beginner
101 Views

Thank-you.  That is what I suspected but just wanted to be sure.

Reply