REUSE Parameter

REUSE is a DEFINE CLUSTER parameter that controls two behaviors: (1) whether the cluster can be reused—opened for output and treated as empty so you can reload it from scratch without deleting and redefining it—and (2) for RRDS, whether a deleted slot (or RRN) can be reused for a new record. You code REUSE or NOREUSE. The default is NOREUSE: the cluster cannot be reused in that way, and for RRDS, deleted slots cannot be reused. Specifying REUSE is required when you want to periodically empty and reload a cluster (e.g. a nightly full refresh) or when you want RRDS slots to be recyclable after DELETE. This page explains the REUSE parameter: what it does for clusters and for RRDS, when to use REUSE vs NOREUSE, and how it affects open and write behavior.

Syntax and Default

In DEFINE CLUSTER you specify:

jcl
1
2
REUSE /* cluster can be reused; RRDS slots can be reused after DELETE */ NOREUSE /* default: no cluster reuse; no RRDS slot reuse */

You specify at most one. If you omit both, the default is NOREUSE. So for cluster reuse or RRDS slot reuse you must explicitly code REUSE.

Two Meanings of REUSE

REUSE applies in two contexts. Both are controlled by the same keyword.

What REUSE and NOREUSE mean
ContextMeaning
Cluster (all types)Cluster can be opened for output and treated as empty; you can reload the entire cluster without deleting and redefining it.
RRDS (slot reuse)When you DELETE a record at an RRN, that slot (or RRN) can be reused: a later WRITE at that same RRN places a new record in the slot.
NOREUSE (default)Cluster cannot be reused (no empty-and-reload without delete). For RRDS, deleted slots cannot be reused; WRITE to that RRN is not allowed.

Cluster Reuse (All Types)

When a cluster is defined with REUSE, it can be opened for output and used as if it were empty. You do not have to delete the cluster and run DEFINE CLUSTER again to reload it. You open the cluster for output (or I-O with the appropriate mode), and the system treats it as empty: you can write records from the beginning. That is useful for clusters that are fully reloaded on a schedule—for example a reference file that is rebuilt every night from a source system. Without REUSE (NOREUSE), opening an existing cluster for output may be restricted or may append; to start from scratch you would normally delete the cluster and define it again. REUSE avoids the delete/define cycle and keeps the same cluster name and catalog entry.

RRDS Slot Reuse

For a Relative Record Data Set (RRDS), REUSE has a second effect: when you delete a record at a given RRN, that slot (in fixed-length RRDS) or that RRN (in variable-length RRDS) becomes available for a new record. A subsequent WRITE with the same RRN will place the new record in that slot or assign that RRN to the new record. So you can delete and re-insert at the same RRN over and over. Without REUSE (NOREUSE), once you delete a record at an RRN, that slot or RRN remains empty. You cannot write to it again. So with NOREUSE the file accumulates empty slots that are never reused. Use REUSE when your application deletes records and then adds new ones at the same positions (e.g. a cache or a table keyed by slot number where slots are recycled).

When to Use REUSE vs NOREUSE

When to use REUSE or NOREUSE
WhenUse
Periodic full reload (KSDS, ESDS)Use REUSE so the same cluster can be opened for output, emptied logically, and reloaded (e.g. nightly batch) without DELETE and DEFINE.
RRDS with delete and re-insert at same RRNUse REUSE so that after DELETE at RRN 5, you can WRITE a new record at RRN 5. Common for caches or tables where slots are recycled.
One-time load, then read-only or appendNOREUSE is fine. You do not need to reuse the cluster or reuse slots.
Audit trail or no overwrite of deleted slotsUse NOREUSE so that once a record is deleted, that RRN is never overwritten. Empty slots stay empty.

Example: KSDS with REUSE for Full Reload

A cluster that is rebuilt from scratch every night can be defined with REUSE so the same cluster is opened for output and reloaded without being deleted.

jcl
1
2
3
4
5
6
7
8
9
10
DEFINE CLUSTER ( - NAME(MY.APPL.DAILY.KSDS) - INDEXED - RECORDSIZE(100 100) - KEYS(12 0) - FREESPACE(10 5) - REUSE - CYLINDERS(20 5)) - DATA (NAME(MY.APPL.DAILY.KSDS.DATA)) - INDEX (NAME(MY.APPL.DAILY.KSDS.INDEX))

The nightly job opens this cluster for output, writes all records from the source (e.g. a sequential file or another VSAM file), and closes it. The next run does the same. The cluster is never deleted; REUSE allows it to be treated as empty each time it is opened for output.

Example: RRDS with REUSE for Slot Reuse

A fixed-length RRDS where slots are frequently deleted and then reused (e.g. a lookup table by slot number) should be defined with REUSE.

jcl
1
2
3
4
5
6
7
DEFINE CLUSTER ( - NAME(MY.APPL.SLOTS.RRDS) - NUMBERED - RECORDSIZE(80 80) - REUSE - CYLINDERS(2 1)) - DATA (NAME(MY.APPL.SLOTS.RRDS.DATA))

When a record at RRN 5 is deleted, that slot is freed. With REUSE, a later WRITE with RRN 5 places the new record in slot 5. Without REUSE, slot 5 would remain empty and could not be used again.

NOREUSE and Empty Slots

With NOREUSE on an RRDS, every time you delete a record you create an empty slot that is never reused. Over time the file can have many empty slots. The file does not shrink; the space for those slots is still allocated. If you need to reclaim space or compact the file, you would typically REPRO to a new cluster (with or without REUSE) that has only the active records, or reorganize in some other way. So NOREUSE is a choice when you want to preserve a strict history (no overwrite of deleted slots) or when deletes are rare and you do not care about empty slots.

REUSE and REPRO

When you use REPRO to load a cluster, the target cluster is often empty (newly defined) or you intend to replace its contents. For a cluster with REUSE, you can REPRO into it and the cluster will be loaded (or reloaded). The REUSE attribute does not change how REPRO works; it only allows the cluster to be opened for output and reused. So REUSE is relevant when the loader is an application program that opens the cluster for output and writes records; it is also consistent with using REPRO to reload the cluster from another source.

Key Takeaways

  • REUSE allows the cluster to be opened for output and treated as empty (reload without delete/redefine), and for RRDS allows deleted slots (RRNs) to be reused for new records.
  • NOREUSE (default): no cluster reuse; for RRDS, deleted slots cannot be reused.
  • Use REUSE for periodic full reloads (same cluster name, reload from scratch) and for RRDS when you delete and re-insert at the same RRN.
  • Use NOREUSE when you do not need reuse or when you want deleted RRDS slots to remain permanently empty.

Explain Like I'm Five

REUSE is like having a whiteboard you can erase and write on again. Without REUSE (NOREUSE), once you erase something you cannot write in that same spot again—the spot stays empty. With REUSE, when you erase (delete) you can write something new in the same spot later. For the whole file: with REUSE you can also "erase everything" and start over without throwing away the whiteboard (the cluster); without REUSE you would have to get a new whiteboard (delete and redefine) to start over.

Test Your Knowledge

Test Your Knowledge

1. What is the default for REUSE in DEFINE CLUSTER?

  • REUSE
  • NOREUSE
  • Depends on dataset type
  • REUSE for RRDS only

2. With REUSE on an RRDS, after you DELETE the record at RRN 10, what can you do?

  • Nothing; the slot is gone
  • WRITE a new record at RRN 10
  • Only READ at RRN 10
  • The file shrinks

3. What does REUSE allow for a KSDS?

  • Variable-length records
  • The cluster to be opened for output and reloaded without deleting it
  • Key changes
  • Multiple keys
Published
Updated
Read time6 min
AuthorMainframeMaster
Reviewed by MainframeMaster teamVerified: IBM z/OS DFSMS documentationSources: IBM DFSMS Access Method Services, VSAM DemystifiedApplies to: z/OS 2.5