To reach a particular record, all the proceeding records must be read. Direct access files allow direct access to a particular record in the file using a key and this greatly facilitates the operations of reading, deleting, updating and inserting records. Organization of Relative files Records in relative files are organized on ascending Relative Record Number. A Relative file may be visualized as a one dimension table stored on disk, where the Relative Record Number is the index into the table. Relative files support sequential access by allowing the active records to be read one after another.
Relative files support only one key.
The key must be numeric and must take a value between 1 and the current highest Relative Record Number. Enough room is allocated to the file to contain records with Relative Record Numbers between 1 and the highest record number. For instance, if the highest relative record number used is 10,000 then room for 10,000 records is allocated to the file. Figure 1 below contains a schematic representation of a Relative file. In this example, enough room has been allocated on disk for 328 records.