On the mainframe, data is stored in datasets. Two broad categories are sequential datasets and VSAM datasets. A sequential dataset is a stream of records in physical order: you read from the start to the end (or write that way). It can live on tape or DASD and is created with JCL. A VSAM dataset is a cluster (KSDS, ESDS, RRDS, or LDS) with internal structure—control intervals and, for KSDS, an index—and is created with IDCAMS and stored only on DASD. This page explains what we mean by "sequential dataset" versus "VSAM dataset," how they differ in storage, creation, and access, and when to choose one type over the other.
A sequential dataset is a dataset whose records are stored one after another in the order they were written. There is no index and no way to address a record by key or by a stored position value; the only way to reach a record is to read from the beginning (or from a position you have kept in the application). Sequential datasets are accessed with BSAM (Basic Sequential Access Method) or QSAM (Queued Sequential Access Method). QSAM is more common: it queues records in buffers and presents a simple read-next or write-next interface. BSAM works with physical blocks and is used when the program needs block-level control.
Sequential datasets have a record format (RECFM: F, V, U, etc.) and logical record length (LRECL) and block size (BLKSIZE). These are specified in the DCB when the dataset is allocated or when it is opened. Sequential datasets can be cataloged or uncataloged and can reside on DASD (disk) or on tape. Tape is a defining characteristic: if you need to ship data off to tape for archival or to another site, you use a sequential dataset. VSAM cannot use tape.
You create a new sequential dataset with JCL: a DD statement with DSN, DISP=(NEW,CATLG), SPACE= (in tracks, cylinders, or blocks), UNIT= (for DASD or tape), and optionally DCB=(RECFM=...,LRECL=...,BLKSIZE=...). No IDCAMS step is involved. Many utilities (IEBGENER, SORT, etc.) read and write sequential datasets. ISPF option 3.4 lets you browse and edit sequential datasets; it does not support VSAM.
A VSAM dataset is a cluster: one logical name that refers to one or two components (data, and for KSDS the index). The cluster has a type: KSDS (key-sequenced), ESDS (entry-sequenced), RRDS (relative record), or LDS (linear). Data is stored in control intervals (CIs) and control areas (CAs). For KSDS, an index maps key values to the CI containing the record, so the program can read or update by key. For ESDS, records are in write order and can be read by Relative Byte Address (RBA) or sequentially. For RRDS, records are in fixed-length slots and addressed by Relative Record Number (RRN). LDS has no record structure and is used by products like Db2.
VSAM datasets are always cataloged and exist only on DASD. They are created with the IDCAMS utility (DEFINE CLUSTER), not with JCL allocation. You do not specify RECFM in JCL for VSAM; record size is defined in DEFINE CLUSTER (RECORDSIZE). Because of the internal format, you cannot browse or edit a VSAM dataset with standard ISPF 3.4; you need a product that understands VSAM (e.g. File-AID, INSYNC, File Manager).
| Aspect | Sequential | VSAM |
|---|---|---|
| Definition | Stream of records in order; no index | Structured (CIs, optional index); key or RBA or RRN |
| Storage media | DASD or tape | DASD only |
| Creation | JCL DD with SPACE and DCB | IDCAMS DEFINE CLUSTER |
| Access | Sequential only (read/write in order) | Sequential, random by key, RBA, or RRN |
| Record format in JCL | RECFM, LRECL, BLKSIZE in DCB | No RECFM; RECORDSIZE in DEFINE CLUSTER |
| ISPF browse/edit | Yes (3.4 browse, edit) | No; use File-AID, INSYNC, or similar |
| Insert/delete in middle | No | Yes (KSDS, RRDS); ESDS append only |
Sequential datasets can reside on tape or on DASD. Tape is used for archival, for shipping data between sites, and for large batch inputs or outputs that don't need random access. When you allocate a sequential dataset on tape, you use UNIT=TAPE or a tape unit name and the system writes records in order. VSAM does not support tape at all; the VSAM access method and control interval structure assume direct access (seek to a location). So if the requirement is "data must be on tape," the choice is a sequential dataset. If the requirement is "fast key-based access on disk," VSAM or a database is the right direction.
A new sequential dataset is created by JCL: a job step that allocates the dataset (often with IEFBR14 or a program that opens and closes the file). The DD statement specifies DSN, DISP=(NEW,CATLG), SPACE=, UNIT=, and optionally DCB. A new VSAM dataset is created by running IDCAMS with a DEFINE CLUSTER command. You specify the cluster name, type (INDEXED/NONINDEXED/NUMBERED/LINEAR), RECORDSIZE, and for KSDS KEYS and optionally FREESPACE. After that, application JCL references the cluster by DSN and DISP=SHR or OLD. So the creation path is different: JCL for sequential, IDCAMS for VSAM.
Browsing and editing also differ. Sequential datasets are standard files that ISPF 3.4 can open: you can browse, edit, search. VSAM datasets are not supported by standard ISPF browse/edit; you need a VSAM-aware tool. That can affect operations and support: if your team relies on ISPF to inspect or fix data, sequential is easier for that. VSAM requires either a dedicated tool or programmatic access (batch or online).
Choose a sequential dataset when the access pattern is strictly one-way and in order, when the data must go to tape, when you want ISPF browse/edit, or when the data is a simple export/import or transfer format.
| Situation | Reason |
|---|---|
| Whole file read or written in order once | No need for index or random access |
| Data must reside on tape | VSAM is DASD only |
| You need ISPF browse or edit | Sequential files are supported; VSAM is not |
| Export/import or transfer to other systems | Sequential (flat file) is the common interchange format |
| Log or audit trail, append-only | Sequential or ESDS both work; sequential is simpler if no RBA need |
Choose a VSAM dataset when you need key-based or position-based access, when the same file is shared by batch and online, when you need inserts and deletes with space reuse, or when the data must stay on DASD with efficient random access.
| Situation | Reason |
|---|---|
| Look up or update by key | KSDS provides indexed access |
| Access by position (RBA or RRN) | ESDS supports RBA; RRDS supports RRN |
| Insert and delete with space reuse | KSDS and RRDS support this; sequential does not |
| Batch and online share same file | VSAM SHAREOPTIONS allows multiple openers |
| Data must stay on DASD with fast key access | VSAM is designed for this |
Sequential datasets use BSAM or QSAM. QSAM is the default for most programs: it handles blocking and buffering and presents logical records to the program. BSAM is used when the program needs to read or write physical blocks. VSAM datasets use the VSAM access method: the program opens the cluster and uses READ (by key, RBA, or RRN), WRITE, REWRITE, DELETE, and CLOSE. VSAM access methods cannot open a sequential dataset, and sequential access methods cannot open a VSAM cluster; the dataset type and the access method must match.
A sequential dataset is like a long roll of paper: you start at the beginning and read or write one line after another. You can't jump to "line 100" without going through the first 99. A VSAM dataset is like a filing cabinet: you can open drawer 1, then 2, then 3 (sequential), or you can go straight to the drawer labeled "Smith" (key) or "drawer 5" (position). The roll of paper can be on a shelf (DASD) or on a tape reel; the filing cabinet only sits on the shelf. So: sequential = one direction, any medium; VSAM = jump by key or position, shelf (DASD) only.
1. Where can a sequential dataset reside?
2. You need to browse the contents with ISPF 3.4. The file is VSAM. What applies?
3. How do you create a new sequential dataset?