Sequential Files

In Sequential file structure, fixed format is used to store records. All records are of some length and arranged in a physical order. Next record is the one that physically follows the previous record. Field name and length are the attributes of this structure. A field known as key field identifies each record in sequential file.

Read and write operations on sequential file are done in sequential order. These files are used in batch applications that involve processing of all records. Sequential files become inadequate for interactive applications that use queries for reading and writing records because queries require random access and in sequential access, satisfying a single request takes a lot of time as every time searching is done sequentially. Unnecessary delays occur, if the user accesses large sequential files.

Index Sequential Files

Index sequential file is an advancement over sequential file. Index sequential file adds the feature of indexing of records to the sequential file. Indexing of records provides the facility of searching records randomly. Index to a file is a simple sequential file that contains index as its record. An entry in index files is made up of two fields. Key field and a pointer pointing to some record in the main file. To find a specific field in main file, index is searched for the highest key value that is equivalent to the desired value. The pointer related to key field starts searching the record at the location it indicates.

Index sequential file reduces the searching time to a great extent keeping the sequential nature of file. To increase the efficiency multiple levels of index are possible in index sequential file. Lower level of index is considered as the sequential file and its higher level is considered as its index file. Index sequential files are stored on the disks.

Indexed File

Both sequential and index sequential file search the records on the basis of key fields. If searching is required on the basis of some other attributes i.e based on some criteria such as value in any field, both these files become inadequate. Third form of file organization scheme that support this feature is known as indexed file.

In this, multiple indexes are maintained, one for each field of a record. Records are searched only through these indexes. Whatever may be the field, its pointer should exist in the related index for searching. Indexed files are used mostly in those applications where accessing time is the main constraint.

Leave a Reply

Your email address will not be published. Required fields are marked *