VSAM Fixed RRDS

A fixed RRDS (Relative Record Data Set) is a VSAM dataset type in which every record has the same length and records are stored in fixed-size slots. Each slot is identified by a relative record number (RRN): slot 1 is RRN 1, slot 2 is RRN 2, and so on. You define a fixed RRDS with IDCAMS using NUMBERED and RECORDSIZE with the same minimum and maximum (e.g. RECORDSIZE(80 80)). There is no index component—only a data component—so the RRN directly corresponds to a slot position. This page explains what a fixed RRDS is, how to define it with DEFINE CLUSTER, the effect of REUSE and NOREUSE, how space and slot count are determined, and when to choose fixed RRDS over variable RRDS (VRRDS) or other VSAM types.

What Is a Fixed RRDS?

A fixed RRDS is one of two RRDS variants. In a fixed RRDS every record has the same byte length. The data component is divided into slots of that size; each slot either is empty or contains one record. The slot number is the RRN. So RRN 1 is the first slot, RRN 2 is the second, and so on. You access records by RRN: set the RRN (e.g. in COBOL RELATIVE KEY) and READ, WRITE, REWRITE, or DELETE. Because record length is fixed, the system can compute the physical position of any slot from the RRN and the record length; no index is needed. That makes the structure simple and direct-addressing fast.

DEFINE CLUSTER for Fixed RRDS

You create a fixed RRDS with the IDCAMS DEFINE CLUSTER command. You must specify NUMBERED to indicate RRDS, and RECORDSIZE with the same value for average and maximum (e.g. RECORDSIZE(80 80) for 80-byte records). You allocate space with CYLINDERS, TRACKS, or RECORDS. Optionally you specify REUSE so that deleted slots can be reused for new records. You define only a DATA component—no INDEX. The INDEX component is used by variable-length RRDS (VRRDS), not by fixed RRDS.

Key DEFINE CLUSTER parameters for fixed RRDS
ParameterDescription
NUMBEREDSpecifies RRDS. Required for any RRDS (fixed or variable).
RECORDSIZE(n n)For fixed RRDS, use the same value twice (e.g. 80 80). Every record is exactly n bytes.
REUSEDeleted slots can be reused; a WRITE to that RRN places a new record in the slot.
NOREUSEDeleted slots remain empty; default in some systems if REUSE is not specified.
CYLINDERS / TRACKS / RECORDSSpace allocation. Number of slots derived from space and record size.
DATA onlyFixed RRDS has no INDEX component; define only the DATA component.

Full DEFINE CLUSTER Example

The following example defines a fixed RRDS with 80-byte records, 2 cylinders primary and 1 cylinder secondary allocation, and REUSE so that deleted slots can be reused.

jcl
1
2
3
4
5
6
7
8
DEFINE CLUSTER ( - NAME(USERID.MY.FIXEDRRDS) - NUMBERED - RECORDSIZE(80 80) - CYLINDERS(2 1) - VOLUMES(volser) - REUSE) - DATA (NAME(USERID.MY.FIXEDRRDS.DATA))

NUMBERED makes it an RRDS. RECORDSIZE(80 80) makes every record 80 bytes and defines the slot size. CYLINDERS(2 1) allocates 2 cylinders primary and 1 secondary. REUSE allows a deleted slot to be reused for a new WRITE at the same RRN. The DATA component is the only component; there is no INDEX. The number of slots is determined by how many 80-byte slots (plus control information per control interval) fit in the allocated space.

RECORDSIZE: Same Min and Max

For a fixed RRDS the average and maximum record size must be the same. So you always specify RECORDSIZE(n n)—for example RECORDSIZE(47 47) or RECORDSIZE(80 80). If you specify different values (e.g. RECORDSIZE(80 120)), you are defining a variable-length RRDS, which requires an INDEX component and different internal structure. The fixed RRDS uses the single value to size each slot: every slot holds exactly n bytes of record data (plus any control bytes that VSAM adds within the CI).

REUSE vs NOREUSE

REUSE means that when you delete a record (DELETE at that RRN), the slot is marked available. A subsequent WRITE with the same RRN will place a new record in that slot. So you can delete and re-insert at the same RRN. NOREUSE (or omitting REUSE on systems where NOREUSE is the default) means that once a record is deleted, that slot remains empty and cannot be used again. The RRN is still valid for READ (you get "record not found") but WRITE to that RRN may not be allowed or may behave differently depending on the system. For many applications REUSE is desired so that space from deleted records can be reused.

Space Allocation and Slot Count

The number of slots in a fixed RRDS is determined by the allocated space and the record (slot) size. You specify space with CYLINDERS(primary secondary), TRACKS(primary secondary), or RECORDS(number). If you use RECORDS(n), the system allocates enough space for n records of the given size. If you use CYLINDERS or TRACKS, the system computes how many slots fit in that space (accounting for control interval layout, RDFs, CIDF, etc.). So you do not always specify the slot count explicitly; it is derived from space and RECORDSIZE. If you need a specific number of slots (e.g. 10,000), you can use RECORDS(10000) if your IDCAMS supports it, or compute the required cylinders or tracks from the record size and device characteristics.

Fixed RRDS vs Variable RRDS (VRRDS)

In a variable-length RRDS (VRRDS) records can have different lengths. You specify RECORDSIZE(min max) with min less than max (e.g. RECORDSIZE(50 200)). VRRDS requires an INDEX component that maps each RRN to the physical location of the record. So VRRDS has both DATA and INDEX; fixed RRDS has only DATA. In fixed RRDS the RRN is the slot index and the slot position is computed. In VRRDS the RRN is a logical record number and the index maintains the mapping. Use fixed RRDS when all records are the same length and you want the simplest structure; use VRRDS when record lengths vary.

Fixed RRDS vs variable RRDS
AspectFixed RRDSVariable RRDS (VRRDS)
Record lengthAll records same lengthRecords can vary (min and max in RECORDSIZE)
IndexNo index componentINDEX component required
SlotOne fixed slot per RRNRRN mapped to record via index
SpacePre-allocated slots; empty slots use spaceSpace used by actual records

No Index Component

A fixed RRDS does not have an index component. The data component is a sequence of control intervals, each containing a number of fixed-size slots. The RRN maps directly to "slot N" and the offset of that slot can be calculated from the record length and the control interval structure. So direct access by RRN does not require an index search—it is a computation. That keeps definition and access simple and avoids index maintenance overhead. Variable-length RRDS, in contrast, needs an index to find where each RRN's record is stored.

When to Use Fixed RRDS

Use a fixed RRDS when: (1) every record is the same length, (2) you want to access records by position (RRN) rather than by key, and (3) you want the simplest RRDS structure without an index. Typical uses include lookup tables keyed by row number, caches where a numeric id maps to a slot, and files where the application assigns and tracks RRNs. If you need variable-length records, use VRRDS. If you need key-based access (e.g. find by customer ID), use KSDS instead. If you need append-only with stable byte addresses, use ESDS.

Operations on Fixed RRDS

You can READ by RRN (direct), WRITE at an RRN (insert into that slot if empty or when replacing per your rules), REWRITE after READ (update in place; record length must stay the same), and DELETE at an RRN (free the slot; with REUSE it can be reused). Sequential access reads records in RRN order (1, 2, 3, …). Dynamic access allows you to position at an RRN with direct READ and then read sequentially from there.

Key Takeaways

  • Fixed RRDS has same-length records; define with NUMBERED and RECORDSIZE(n n).
  • Only the DATA component is defined; no INDEX component.
  • REUSE allows deleted slots to be reused for a new WRITE at the same RRN.
  • Slot count is derived from allocated space and record size.
  • Use fixed RRDS when all records are the same length and you want direct access by RRN without an index.

Explain Like I'm Five

Imagine a parking lot where every space is the same size. Each space has a number: 1, 2, 3, 4, 5. That's a fixed RRDS: same-size "records" (parking spaces), and each space has a number (RRN). To park a car (WRITE), you pick a space number. To get a car (READ), you go to that space number. If you drive away (DELETE), the space is empty. If the rule is REUSE, someone else can park in that same space number later. The lot has no "index"—you just know space 5 is the fifth space.

Test Your Knowledge

Test Your Knowledge

1. Which parameter identifies a cluster as an RRDS?

  • RECORDSIZE
  • NUMBERED
  • REUSE
  • INDEXED

2. For a fixed RRDS, what must RECORDSIZE look like?

  • RECORDSIZE(0 80)
  • RECORDSIZE(80 80) — same min and max
  • RECORDSIZE(80 100)
  • RECORDSIZE(avg max) with avg < max

3. Does a fixed RRDS have an INDEX component?

  • Yes, always
  • No; only DATA component
  • Only with REUSE
  • Only for sequential access
Published
Updated
Read time4 min
AuthorMainframeMaster
Reviewed by MainframeMaster teamVerified: IBM z/OS 2.5 documentationSources: IBM DFSMS Access Method Services, z/OS VSAM documentationApplies to: z/OS 2.5