Sequential File Organization

  • Originally, sequential files were developed for magnetic tapes
  • Sequential files are similar to serial files, however, the data is sorted using key fields in sequential files.
  • Entries in a sequential file are ordered. This organization is fixed and usually cannot be changed without rewriting the whole file.
  • To update sequential files, they have to be stored in the primary memory entirely and then sorted/updated there, before being written back onto the tape/disk.


From IBM:
"After you have placed a record into a sequential file, you cannot shorten, lengthen, or delete the record. However, you can update (REWRITE) a record if the length does not change. New records are added at the end of the file."
IBM Website


7.1.2 - Unordered Records
Records are not organized by a specific pattern. To retrieve an entry, the file has to be scanned, starting at the beginning. At some point you should find the required record.

For example:
RecordC
RecordG
RecordB
RecordA
RecordH
RecordE
RecordF
RecordD


7.1.3 - Ordered Records
Records are organized according to a certain key field. This enables one to apply batch updates/deletes, for example. However, when writing a new entry to the file, it can't simply be added to the end of the file. It has to be put into the right spot in the file. If this is not at the end then the whole file has to be read into the main memory, rearranged and finally written back to a new file with the new entry included.

Example of an ordered sequential list:
RecordA
RecordB
RecordC
RecordD
RecordE
RecordF
RecordG
RecordH

Last modified by: Jocbe
Last update: 6. September 2011

Sources: