NONINDEXED is the DEFINE CLUSTER keyword that creates an Entry-Sequenced Data Set (ESDS). An ESDS has only a data component—no index and no primary key. Records are stored in the order they were written (entry sequence) and stay in that order. You access records by reading sequentially from the beginning (or from a given RBA) or by using the relative byte address (RBA) of a record that you obtained from a previous read. You cannot insert a record in the middle or physically delete a record; new records are appended at the end. NONINDEXED is one of four organization types (with INDEXED, NUMBERED, LINEAR) and is the right choice when you need write-order preservation, RBA-based access, or a simple append-only structure such as a log or audit trail. This page explains what NONINDEXED does, how it differs from INDEXED and the other types, and when to use it.
When you specify NONINDEXED in DEFINE CLUSTER, you are telling IDCAMS to create an ESDS. The cluster has a single component—the data component. There is no index component, so VSAM does not maintain a key-based index. Records are written one after another in the order the program writes them; that order is preserved. The first record is at the beginning of the dataset, the next follows it, and so on. To read a specific record later, you either read sequentially from the start (or from a saved RBA) or you use a previously saved RBA to do a direct read by RBA. Because there is no key, you cannot say "give me the record with key X"; you can only say "give me the record at this byte offset" (RBA) or "read the next record in sequence."
INDEXED (KSDS) gives you a key and an index. You specify KEYS(length offset), and VSAM keeps records in ascending key order and lets you read by key or sequentially in key order. You can insert, update, and delete by key. NONINDEXED (ESDS) has no key. You do not specify KEYS. Records stay in the order they were written. You access by RBA or sequential read. You can only append at the end; you cannot insert in the middle. You cannot physically delete a record (the bytes stay in place). So: use INDEXED when you need key-based lookup and key order; use NONINDEXED when you need write-order preservation, append-only behavior, or RBA-based access (e.g. when you have saved an RBA from a previous read and want to return to that record later).
The following table summarizes the main characteristics of a NONINDEXED (ESDS) cluster. These follow from the absence of an index and the entry-sequenced design.
| Aspect | Value |
|---|---|
| Components | Data component only; no index |
| Key | None; do not specify KEYS |
| Record order | Entry sequence (order written) |
| Access | Sequential (forward/backward) or by RBA |
| Insert | Append only at end (no insert in middle) |
| Delete | No physical delete; logical delete only |
| Update | REWRITE in place at same RBA |
For NONINDEXED you do not specify KEYS. There is no primary key. You do specify RECORDSIZE (minimum and maximum record length, or fixed length) so that VSAM knows the record layout. You specify space allocation (CYLINDERS, TRACKS, or RECORDS), and optionally VOLUMES, SHAREOPTIONS, and a DATA component name. There is no INDEX component, so there is no INDEX(...) clause. FREESPACE is not used for ESDS in the same way as for KSDS (ESDS does not do key-ordered inserts or CI/CA splits in the middle); space is simply used sequentially as you append.
In DEFINE CLUSTER you code NONINDEXED as the organization keyword. Example:
1234567DEFINE CLUSTER ( - NAME(USERID.APPL.LOG.ESDS) - NONINDEXED - RECORDSIZE(200 500) - CYLINDERS(5 2) - VOLUMES(SYSDA)) - DATA (NAME(USERID.APPL.LOG.ESDS.DATA))
NONINDEXED makes this an ESDS. RECORDSIZE(200 500) allows variable-length records from 200 to 500 bytes. There is no KEYS and no INDEX clause. Records will be stored in the order they are written and can be read sequentially or by RBA.
Use NONINDEXED (ESDS) when: (1) You need to preserve the exact order in which records were written (e.g. event log, audit trail, transaction log). (2) You only append new records and do not need to insert in the middle or delete. (3) You access by position—either sequential read from the start or by RBA that you saved from a previous read. (4) You want a simple structure with no index overhead. (5) Your application does not need to look up a record by a key value. Use INDEXED (KSDS) when you need key-based access, key order, or insert/delete in the middle. Use NUMBERED (RRDS) when you address by relative record number and have fixed-length records. For logs, history files, and append-only streams, NONINDEXED is often the right choice.
Because ESDS does not support physical delete, applications that need to "remove" a record often use logical delete: a byte or field in the record (e.g. a status or delete flag) is set to indicate that the record is no longer valid. When reading, the program skips records with that flag set. The record remains on DASD and its space is not reclaimed, but logically it is treated as deleted. To reclaim space you would have to REPRO to a new ESDS, copying only the records you want to keep.
NONINDEXED is like a diary: you write on the next blank page each time, and the pages stay in the order you wrote them. You can't tear out a page (no physical delete) and you can't insert a new page in the middle. If you want to find something you wrote earlier, you either flip through from the start or you remember "it was on page 10" (that's like using the RBA). INDEXED is like a filing cabinet with labels: you can add folders in the right place and remove them. So NONINDEXED is for "keep everything in order as I write it"; INDEXED is for "find and change things by name or ID."
1. Which DEFINE CLUSTER keyword creates an ESDS?
2. Do you specify KEYS when defining a NONINDEXED cluster?
3. How do you add a new record to an ESDS?