Sequential vs Indexed vs Relative Files


Sequential Files Indexed Files Relative Files
Sequential files are QSAM files. Indexed files are VSAM files. Relative files are VSAM files (RRDS).
Records are written in entry sequential order. Records are written in key sequential order. Records are written in Record Relative Number order.
Duplicate records are allowed to be written into the file. Duplicate records are not allowed to be written into the file. Duplicate records are not allowed to be written into the file.
Records need not be in sorted order. Records are in sorted order based on key. Records are in sorted order based on RRN.
Record deletion is not possible. Records deletion is possible. Records deletion is not possible, but the memory will not reused.
Accessing records is slow because the records can only be read in sequential order. Accessing records is faster because the records can be read dynamically or randomly. Accessing records is faster than indexed files as the records can be read using RRN.
The key concept is not available. The key is available. The key is user-defined and is part of the record. The key is available. The key is system-generated and is outside of a record.
Data can be stored on tape/disk. Data can be stored on disk only. Data can be stored on disk only.
File opening modes are – INPUT, OUTPUT, I-O, and EXTEND. File opening modes are – INPUT, OUTPUT, and I-O. File opening modes are – INPUT, OUTPUT, and I-O.
Sequential files are used frequently. Indexed files are frequently used. Relative files are used very rarely.