Monday, 28 July 2014

COBOL Index Sequential File.

The index sequential ORGANIZATION is the most sophisticated and widely used among the three file ORGANIZATIONs. It facilitates both sequential and random access of records. An index sequential file is conceptually made up of two files, a data file and an index file. 

Each record has a key value associated with it. Though the records are stored in the order in which they are entered, a sorted index is maintained which relates the key value to the position of the record in the file and hence provides a way to access the records both sequentially and randomly.

There are several methods that are used for storing the index. One method is the sparse index. In this method, data within a particular range of key values is stored together. In the latest indexed file implementations, a dense index is maintained. Here, the key value of each record is stored in the index along with the address in the file where the data is to be found. 

Example: Employee sequential file.

This is normally maintained as a B-tree to aid searching and changes. In index sequential ORGANIZATION, we can even specify alternate indexes. 

It is important to note that the number of indexes improves performance on reads but affects performance on writes. This is because all indexes have to be updated on each write operation.

How indexed files are implemented varies from one platform to another. One common way to implement these files is with one file for the index and another file for the data. On some platforms, though, the index and the data are implemented in a single file.

To improve I/O efficiency, the records in indexed files are often blocked.

Created with Artisteer

No comments:

Post a comment