Topic+7

Topic 7 : **File Organization**
toc

**Serial files:**
Records in these files are unordered. The records are added as they come. The search has to be done on the entire file to get to the desired record - sequential access.

**Sequential files:**
Records have been put in some predetermined order. E.g. student admission forms are put in the order of form serial number. Can be accessed sequentially. File maybe updated using another sequential file, sorted on the same key field. Updating of a sequential file requires a complete rewrite of the original file. Storage device like a tape necessarily stores data in a sequential file.

**Partially indexed sequential file**
This is a sequential file, has ordered records but has a partial index. To retrieve a record in this file organization, you would randomly reach the first record of a group via the index, then read through that group sequentially to reach the desired record. e.g. your phone book - you have a page beginning A, within that page you recorded the phone numbers of friends as and when you needed.

**Fully-indexed files or Random access file**:
Each record in this file is of fixed length. This file would contain unordered records, but would have a separate and complete index. The index has all records in it. Records can be retrieved via access to the index. The index would be read sequentially and then a direct access is done in the data file. The index may get too large for a large data base. This file can only be on random access media like a disc, hard drive.

**Direct access file**
The records are of fixed length, you may reach for a record by calculating the record position ( hash code) and then do a direct access. Fastest way of retrieving the data. In a fully indexed file, at least two disk accesses are required - one to retrieve the index, then to retrieve data record, however in hashed files, only one access is required.

**External sort**
When the physical size of the file is too large for the complete file to be read into the memory, a combination of sorting and merging is carried out.