Giving clear reasons, explain why the average search time to find an indexed sequential file is less than that needed to find a non-indexed sequential file. (6 Marks) An indexed sequential file allows serial access to the records but also allows access directly via the index, which will be much quicker. • Records in key order • Index allows data to be accessed directly therefore faster since index contains key and record address Indexed Sequential File Adds an index to the file to support random access Adds an overflow file Greatly reduces the time required to access a single record Multiple levels of indexing can be used to provide greater efficiency in access Indexed Sequential File • Index provides a fast lookup capability • Contains key field and a pointer to main file • Only select indices from main file are stored in the index (requires some sequential search of file) • New records stored in separate overflow file Indexed Sequential File Explanation Indexed Sequential File is a computer file that contains index. The difference in this file and the indexed file is that the index in this file acts no more than a pointer to a memory block. The index points to the block from where the data records are retrieved. You can think of a computer index the same way you think of an index in a book. You use an index in a book to find what you want quickly the same is true with a computer index. An index always contains two fields. One is the symbolic key and the second the corresponding storage address for the record. The index is a separate file from the master file to which it refers to, and it contains only the record key and the storage address. To find a record, the program will scan the index and then retrieve the record from the file at the location specified by the index. (Figure 2-4) The index makes it possible to read the file sequentially or randomly. Indexed-sequential file organization method Almost similar to sequential method only that, an index is used to enable the computer to locate individual records on the storage media. For example, on a magnetic drum, records are stored sequential on the tracks. However, each record is assigned an index that can be used to access it directly. Indexed sequential refers to a file management system that allows records to be accessed either sequentially meaning in the order they were entered or randomly meaning with an index. Index files are extremely useful as they can be sequentially processed when all or most of the records need updating or printing and randomly when only a few need to be directly accessed. They are suitable for real-time stock control systems An Indexed Sequential File is organised so that it is easy to find information quickly without the computer having to search through the whole file. The file includes a number of indexes and the computer can look at these to find exactly where in the file to find the record - in much the same way that you would use a library catalogue to find a book rather than looking along all the shelves. This is ideal for files which are used for reference - such as in an airline booking system or a library catalogue: it would be very slow to have to hunt all the way through the files in order to find a particular flight or a particular library book - so an ordinary sequential file would not be suitable. It is possible to insert new records into an Indexed Sequential File - so it is not necessary to copy a whole file across to a new one just to add a single record (as would be the case with a sequential file) as the system leaves space for later insertions; likewise, it is easy to alter a record in place without writing the whole file out again, or to delete a record. Again this is very suitable for systems such as travel or theatre booking where information has to be changed frequently and it would be inefficient to copy out a whole file again just to alter information about one or two seats. When setting up an Indexed Sequential File in the first place, the programmer has to specify which field will be used as the key field - e.g. a student fIle might use student name, or number as the key field - this is the item which will be looked up in the index in order to find a record. Note that some operating systems automatically set up a properly indexed file with sufficient space when your program runs: with others however you will have to set up a template for the file (i.e. give infonnation about it) using a utility program before running the program which will use the file.