Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner

Empty Space in Direct Access Files?

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
Highlighted
Black Belt

All the records, from the

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.

--
Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran
0 Kudos
Highlighted
Beginner

Thank-you.  That is what I

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

0 Kudos