Summary -

In this topic, we described about the Diffence between Files with detailed example.

Below are the differences in between sequential, indexed and relative files.

Sequential Files Indexed Files Relative Files
Sequential files are called as QSAM files. Indexed files are called as VSAM files. Relative called as 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 write into the file. Duplicate records are not allowed to write into the file. Duplicate records are not allowed to write into the file.
Records are not in sorted order. Records are in sorted order based on key. Records are in sorted order based on RRN.
Record deletion is not possible. Record can be deleted. Record can be deleted but the memory not reused.
Records accessing is slow because the records only read in sequential order. Records accessing is faster because the records can read dynamically or randomly. Records accessing is faster than indexed files as the records can read using RRN.
Record key is not available. Record key is available. Key is user defined and is part of the record. Record key is available. Key is system generated and is outside of a record.
Data can store on tape/disk. Data can store on disk only. Data can store on disk only.
File opening modes are – INPUT, OUTPUT, I-O, EXTEND. File opening modes are – INPUT, OUTPUT, I-O. File opening modes are – INPUT, OUTPUT, I-O.
Sequential files are used frequently. Indexed files are used rarely. Relative files are used very rarely.