A fixed-length RRDS (Relative Record Data Set) is an RRDS in which every record has the same length. You define it with RECORDSIZE(n n)—the same value for average and maximum—and NUMBERED. The data component is divided into fixed-size slots: slot 1 holds one record of that length, slot 2 holds one record, and so on. Each slot has a fixed RRN. Slots can be empty (no record yet or record deleted) or full. With REUSE, when you delete a record the slot becomes available for a new WRITE at the same RRN. Fixed-length RRDS has no index component; addressing is by slot (RRN) only. This page explains how fixed-length RRDS is defined, how REUSE and NOREUSE affect slot reuse, how insert/delete/replace work, and how it compares to variable-length RRDS (VRRDS).
In a fixed-length RRDS every record is exactly the same size—for example 80 bytes or 100 bytes. When you define the cluster you specify RECORDSIZE with the same value for both the average and maximum record length (e.g. RECORDSIZE(80 80)). The system then divides the allocated space into slots of that size. Slot 1 corresponds to RRN 1, slot 2 to RRN 2, and so on. When you WRITE a record you specify the RRN; the record is placed in that slot if it is empty (or if you are replacing). When you READ you specify the RRN and get the record in that slot, or a "not found" if the slot is empty. So the structure is a fixed array of slots, each slot holding zero or one record of fixed length. There is no index component; the RRN directly implies the slot position.
| Parameter | Description |
|---|---|
| NUMBERED | Specifies RRDS (required for RRDS). |
| RECORDSIZE(n n) | Fixed length: set both average and maximum to the same value (e.g. 80 80 for 80-byte records). |
| REUSE | Deleted slots can be reused; a WRITE to that RRN places a new record in the slot. |
| NOREUSE | Deleted slots stay empty; no reuse (default in some systems). |
| DATA only | Fixed-length RRDS has no INDEX component; only the DATA component is defined. |
Space is usually specified with CYLINDERS or TRACKS (or RECORDS). The number of slots is derived from the allocated space divided by the slot size (record length plus any control information per slot). So for a given allocation and record length, you get a fixed maximum number of slots (RRN 1 through N).
REUSE means that when you delete a record at a given RRN, that slot is marked as empty and can be used again. A subsequent WRITE with that same RRN will place the new record in the slot. So you can delete and re-insert at the same RRN over time. NOREUSE means that once a record is deleted, the slot remains empty forever (for that cluster). You cannot write to that RRN again. So with NOREUSE the file can only grow in "used" slots until you have deleted so many that you have many empty slots you cannot reuse. REUSE is common when you want to reuse slots (e.g. a cache or a table where records are frequently deleted and new ones added at the same positions). NOREUSE might be used when you want a strict audit trail and never want to overwrite a slot.
| Operation | Description |
|---|---|
| Insert | WRITE with a specific RRN. If the slot is empty, the record is placed there. With REUSE, an empty slot (from a prior DELETE) can be used. |
| Delete | DELETE at that RRN frees the slot. With REUSE the slot is available for a new WRITE at the same RRN. |
| Replace/Update | REWRITE after READ updates the record in the same slot; length must not increase (fixed length stays the same). |
For replace (update), you READ the record at an RRN, modify the record in your buffer, and REWRITE. The record length must not change (it is fixed). So you are updating the content of the slot in place.
12345678DEFINE CLUSTER ( - NAME(USERID.MY.RRDS) - RECORDSIZE(80 80) - CYLINDERS(2 1) - VOLUMES(volser) - NUMBERED - REUSE) - DATA (NAME(USERID.MY.RRDS.DATA))
This creates an RRDS with 80-byte fixed-length records. NUMBERED makes it an RRDS. REUSE allows deleted slots to be reused. There is no INDEX component. The number of slots depends on how many 80-byte slots (plus control info) fit in 2 cylinders primary, 1 secondary.
| Aspect | Fixed-length RRDS | Variable-length RRDS (VRRDS) |
|---|---|---|
| Record length | All records same length (e.g. 80 bytes) | Records can vary (e.g. 50–100 bytes) |
| Index | No index component | Index component required |
| Slot | Fixed slot per RRN; slot size = record size | No fixed slots; index maps RRN to record |
| Storage | Pre-allocated slots; empty slots use space | Space used by actual records |
Use fixed-length RRDS when every record is the same size and you want simple slot-based addressing without an index. Use variable-length RRDS when record lengths vary; you must define an INDEX component and the system maintains RRN-to-record mapping through the index.
In a fixed-length RRDS, space is pre-allocated for every slot. So if you allocate 10,000 slots and only use 1,000, the file still occupies space for 10,000 slots. Empty slots use space. That is the tradeoff: direct addressing by RRN is fast and simple, but you may reserve more space than you need. When you delete records with REUSE, the slots become available for new records but the total allocation does not shrink unless you redefine the cluster or REPRO to a new one with less space.
In COBOL the record description must match the fixed length. For an 80-byte RRDS you might have RECORD CONTAINS 80 CHARACTERS and a 01 level with PIC X(80). The RELATIVE KEY holds the RRN. For random access you MOVE the RRN to the RELATIVE KEY and READ, WRITE, REWRITE, or DELETE.
Fixed-length RRDS is a good fit when you have a natural slot or record number (1 to N), all records are the same length, and you want direct access by that number without maintaining a key. Examples: a lookup table by row number, a cache where an id maps to a slot, or a simple direct file where the application controls the RRN. If you need variable-length records or key-based access, use VRRDS or KSDS instead.
Imagine a tray with the same number of same-size cups. Each cup has a number (RRN). You can put one treat in cup 3, or take it out. If you take it out (delete), the cup is empty. If your rule is REUSE, you can put a new treat in cup 3 later. If your rule is NOREUSE, cup 3 stays empty forever. Every cup is the same size—that's fixed length.
1. For a fixed-length RRDS, what must RECORDSIZE look like?
2. What does REUSE do in an RRDS?
3. Does a fixed-length RRDS have an INDEX component?