Post by m***@gmail.comHi Guys,
I have understood the use of different enscribe files on tandem. But I am not able to understand the practical use of Relative files.
Would be helpful if someone explain me. Waiting for your valuable response.
Kind Regards!
Naveen
It seems to me that you are asking for specific examples in which a relative file would be a better choice than any of the other types. I believe most people would agree that there are not many such examples.
The characteristics of a situation in which you would find a relative file a good choice are:
1. The records do not contain any field whose value uniquely identifies the record, so there is no field that can be used as a primary key.
2. You need random access to the records.
3. You have some reasonable way to make up a key for each record that is a small integer, or your application can function with a system-assigned small integer value for the key of each record.
4. You do not want to add a field to the record to hold the key you make up for each record.
5. It is not important to make it easy to be able to port the database to other computer systems.
I think that, in most cases, it would be better to add a field to the record to serve as the primary key, and put the data in a key-sequenced file rather than use a relative file. That is portable, and just about any programmer would be familiar with such a database design. However, if fastest access to records is critical, a relative file does have the advantage that, given the record number, the block that contains the record can be accessed in one disk read. Key-sequenced files require additional disk reads to work through the index to locate the block that contains the data record (though very often, the index blocks are in the disk cache).
It is possible that I have not taken all relevant factors into consideration, so I invite corrections to this view.