COBOLintermediate

File Handling: SEQUENTIAL vs INDEXED Organization

Distinguish sequential and indexed file organizations in COBOL and know which I/O verbs and access modes apply to each.

COBOL programs interact with three broad dataset organizations — sequential, indexed (VSAM KSDS), and relative — and the choice drives which verbs, access modes, and error handling apply. This topic sits at the intersection of COBOL syntax and VSAM/dataset knowledge, so interviewers use it to check whether you can connect the ENVIRONMENT DIVISION's SELECT clause to real access patterns.

Sequential access is reading a novel page by page; indexed random access is looking up a specific topic in the back index of a textbook and flipping straight to page 342 without touching pages 1 through 341.

Key Concepts

1
SEQUENTIAL organization simply means records are read or written in physical order, one after another, using OPEN, READ, WRITE, and CLOSE. It maps naturally to flat files and GDGs and is the natural fit for batch processing that touches every record — daily transaction extracts, full-file reports, and so on.
2
INDEXED organization (typically backed by a VSAM KSDS) allows records to be retrieved directly by key rather than only in sequence, via ACCESS MODE IS RANDOM, SEQUENTIAL, or DYNAMIC. RANDOM access does a direct key lookup, DYNAMIC allows switching between sequential and random within the same open, which is essential for programs that first position with a START and then read forward.
3
A classic interview probe is: 'Your program needs to find one customer record among ten million — what file organization and access mode do you choose, and why?' The expected answer is INDEXED with ACCESS MODE IS RANDOM, because a sequential scan of ten million records is unacceptable when a key-based VSAM lookup resolves in near-constant time via the index component.