VSAM Relative Record Data Sets (RRDS) model data as numbered slots in a fixed-size table. Slot 1, slot 2, slot 47—each position holds one fixed-length record or remains empty until written. Easytrieve declares RRDS with FILE file-name RELATIVE, optionally UPDATE for rewrite and delete paths. This organization suits rate tables indexed by day-of-year, disk allocation maps, and legacy applications where the record number is the business key. Unlike KSDS, there is no separate index component keyed by employee number; the relative record number (RRN) is the address. Unlike ESDS, you can read and rewrite slot 100 without scanning slots 1–99. Beginners often confuse RELATIVE on FILE with relative byte positions in DEFINE—that is a different topic. This page teaches RRDS catalog concepts, FILE RELATIVE parameters, direct slot access, sequential browse through slots, sparse files, CREATE sizing, FILE-STATUS on empty slots, and when operations choose RRDS instead of INDEXED masters.
IDCAMS DEFINE CLUSTER with NUMBERED YES creates RRDS. MAXRECORDS or equivalent sizing sets how many slots exist. Each slot is the same record length—variable-length RRDS is not the VSAM model. Easytrieve FILE RATES RELATIVE UPDATE FB(50 500) names the file, selects relative organization, permits update, and fixes record length at 50 bytes. Fields in the FILE section overlay every slot uniformly. JCL DD points at the RRDS cluster; DISP=SHR for read, UPDATE for rewrite jobs. The product opens with relative access methods when RELATIVE is coded; omitting RELATIVE on an RRDS DD causes organization mismatch errors similar to coding INDEXED on ESDS.
123456789101112131415161718FILE DAILY-RATE RELATIVE UPDATE FB(20 200) DAY-NO 1 3 N RATE-VALUE 4 5 P 2 DEFINE SLOT-NO 3 N JOB INPUT NULL NAME PROCESS-DAYS PROCESS-DAYS. PROC DO DAY = 1 TO 366 MOVE DAY TO SLOT-NO MOVE DAY TO DAY-NO READ DAILY-RATE RECORD SLOT-NO STATUS IF DAILY-RATE-PRESENCE PRINT DAY-NO RATE-VALUE END-IF END-DO END-PROC
Pseudocode illustrates direct slot access: for each calendar day 1–366, position at slot DAY and READ. Exact READ grammar for relative record numbers follows your Language Reference release—some sites use MOVE slot to a key field then READ file. Test STATUS and file-presence constants before PRINT because empty slots may not contain business data. UPDATE allows rewriting RATE-VALUE when loading the table from a maintenance program.
| VSAM org | FILE type | How you address a row |
|---|---|---|
| ESDS | SEQUENTIAL | Sequential order—next GET |
| KSDS | INDEXED | Primary key in record—READ key |
| RRDS | RELATIVE | Slot number 1–n—direct RRN |
Pick RRDS when the application already numbers entities 1 to MAX and empty slots are acceptable. Pick KSDS when keys are alphanumeric or non-dense. Pick ESDS for append-only logs. Easytrieve can reference all three in one program with separate FILE statements and distinct DD names.
GET on RELATIVE file walks slots in ascending record number from the current position, similar to sequential browse on INDEXED. START may position at a slot before GET loops. JOB INPUT on RELATIVE with UPDATE in batch walks slots with hold semantics per FILE UPDATE rules. Use JOB INPUT NULL when you must mix direct READ of scattered slots with other files in one activity—see multiple-files tutorial. EOF on RRDS means past the highest defined slot in browse context, not necessarily every intermediate slot was filled.
WRITE into slot n creates or replaces that slot's record. DELETE clears a slot per VSAM rules. Sparse files have holes: slots 1, 5, and 99 written while 2–4 are empty. Reporting jobs must not assume continuity. Some applications store an active flag in the record to distinguish never-written slots from deleted business rows. DUPLICATE is a KSDS concern; RRDS instead fights reading empty slots as valid rates or quantities.
123FILE NEWTAB RELATIVE CREATE FB(100 1000) TAB-ROW 1 3 N TAB-DATA 4 96 A
CREATE builds a new relative file when the program runs. Catalog MAXRECORDS must accommodate highest slot you will WRITE. Undersized clusters fail when you WRITE slot 50000 but only 1000 slots exist. Operations often pre-allocate RRDS in IDCAMS; Easytrieve CREATE suits smaller tables. RESET behavior matches FILE CREATE rules for VSAM REUSE on mainframe batch.
RRDS requires fixed record length. Use FB on FILE with explicit length matching IDCAMS RECORDSIZE. VB and VBS are for sequential organizations, not RRDS slots. WORKAREA and BUFNO still apply for tuning but do not change slot geometry. Field definitions must fit within the fixed LRECL—overflow fields truncate or fail compile depending on checks.
STATUS on READ, GET, WRITE populates FILE-STATUS. Empty slot reads may return specific VSAM codes documented for your release—trap them before arithmetic on RATE-VALUE. NOTFOUND and EOF constants apply in IF procedures. Indexed and relative file functions chapter lists helpers parallel to KSDS processing. Logging failing slot numbers on SYSPRINT accelerates table load debugging.
Legacy FILE VS (F ...) meant fixed-length VSAM in older manuals; RELATIVE is the modern FILE type for RRDS. Migrated sources may still compile VS forms; new development should standardize on RELATIVE UPDATE CREATE keywords for clarity in code reviews.
An RRDS is a row of numbered mailboxes. Mailbox 1, mailbox 2, up to the last box. Each box is the same size. You open box 17 directly when you know the number—you do not walk from box 1 every time. Some boxes are empty until you put a letter in. Easytrieve RELATIVE on FILE tells the computer you are using numbered boxes, not a single long line (ESDS) or a name catalog (KSDS).
1. VSAM RRDS in Easytrieve uses FILE type:
2. RRDS records are identified primarily by:
3. An empty RRDS slot may read as:
4. RELATIVE differs from INDEXED because:
5. FILE UPDATE on RELATIVE allows: