Serial file organisation is the simplest file organisation method. In serial files, records are entered in the order of their creation. As such, the file is unordered, and is at best in chronological order. Serial files are primarily used as transaction files in which the transactions are recorded in the order that they occur.
Sequential Files
The key difference between a sequential file and a serial file is that it is ordered in a logical sequence based on a key field. This key is usually the primary key, though secondary keys may be used as well. Sequential files are therefore files that are sorted based on some key values.
Sequential files are primarily used in applications where there is a high file hit rate. Hit rate is a measure of the proportion of the records that is accessed in a single run of the application. Therefore, sequential files are ideal for master files and batch processing applications such as payroll systems in which almost all records are processed in a single run of the application.
Random Files
In random file organisation, records are stored in random order within the file. Though there is no sequencing to the placement of the records, there is however, a pre-defined relationship between the key of the record and its location within the file. In other words, the value of the record key is mapped by an established function to the address within the file where it resides. Therefore, any record within the file can be directly accessed through the mapping function in roughly the same amount of time. The location of the record within the file therefore is not a factor in the access time of the record. As such, random files are also known in some literature as direct access files.
To create and maintain a random file, a mapping function must be established between the record key and the address where the record is held. If M is the mapping function, then
M(value of record key) => address of record
Hashing
There are various mapping techniques. Some involve using the key field to directly map to the location with the file, while others refer to some lookup table for the location. However, the more common method is to employ a hash function to derive the address.
Hashing is the process of transforming the key value of a record to yield an address location where the record is stored. In some literatures, it is also known as Key-to-Address Transformation, Address-Calculation, Scatter Storage, or Randomization.
A hash function generates the record address by performing some simple operations on the key or parts of the key. A good hashing function should be
•quick to calculate
•give an even distribution
•not generate addresses that tend to cluster within a few locations, thus resulting in frequent collisions.