FOR and TO are DEFINE CLUSTER parameters that express dataset retention in the catalog’s attribute model. They answer the business question, "How long must this cluster survive before the system may consider it eligible for scratch?" in either relative or absolute terms. Beginners sometimes assume retention is only a label with no teeth, but in well-run shops it feeds into HSM, DFSMSrmm or tape management policies, and automated catalog cleaners that reconcile expired non-VSAM and VSAM objects according to rules far larger than a single IDCAMS statement. Understanding FOR and TO therefore connects low-level JCL to compliance and cost control: a misplaced TO date can delete evidence too early, while an overly long FOR can strand space on expensive tiers because nobody is allowed to reclaim it yet.
FOR expresses a duration. IBM’s syntax documentation for your z/OS release is authoritative for whether you specify days as a simple number or use structured subfields. The conceptual point is relative time: the catalog computes an expiration timestamp from a reference event such as creation or last reference according to the attribute definition. Relative retention fits workloads like "keep this extract ninety days after it was built" where the clock starts when the cluster is defined or when it is last touched, depending on the attribute semantics you selected in the full DEFINE grammar. When multiple teams share patterns, storage publishes standard FOR values per dataset class so auditors can sample LISTCAT output and verify uniform policy application instead of hand-negotiating each file.
TO pins the cluster to a calendar expiration. That is appropriate when legal or audit mandates name a specific cutoff, such as the end of a fiscal archiving window. Absolute dates remove ambiguity about leap years and manual arithmetic that relative durations can introduce when operators recreate files near midnight on the last day of the month. The downside is maintenance: if the project extends, someone must ALTER or redefine attributes before the TO date passes and automated housekeeping takes action. Good change control treats TO like any other production date field with reminders in the ticketing system.
SMS management classes can specify retention and migration behavior that either complements or overrides naive expectations from raw IDCAMS parameters, depending on how ACS routines assign classes and how the storage administrator modeled the MC. A beginner should not assume that DEFINE alone is the only place retention is decided; it is the declaration at birth. Later life-cycle behavior may be governed by DFSMShsm, ABARS, or vendor tools reading catalog and MC information together. When troubleshooting "why was my file scratched," the investigation spans DEFINE, MC, and batch scratch jobs, not only the FOR/TO fields visible in a tutorial example.
| Business need | Typical approach |
|---|---|
| Temporary extract file for ninety days | FOR with duration matching policy; document owner and downstream purge job. |
| Regulatory hold until a calendar cutoff | TO with explicit yyyy/ddd or supported date form per manual. |
| Permanent reference data | Often omit FOR/TO or use site-standard unlimited patterns; align with SMS MC. |
Exact syntax for date literals evolves; always verify against IBM manuals for your release. The fragments below are pedagogical shapes, not guaranteed compile-ready without local adjustment.
123456789101112131415161718192021DEFINE CLUSTER ( - NAME(USERID.TEMP.WORK) - NONINDEXED - RECORDSIZE(256 256) - FOR(30)) - DATA (NAME(USERID.TEMP.WORK.DATA) - CYLINDERS(1 1) - VOLUMES(SYSDA)) DEFINE CLUSTER ( - NAME(USERID.AUDIT.ARCHIVE) - INDEXED - RECORDSIZE(500 500) - KEYS(12 0) - TO(2030/001)) - DATA (NAME(USERID.AUDIT.ARCHIVE.DATA) - CYLINDERS(20 10) - VOLUMES(SYSDA)) - INDEX (NAME(USERID.AUDIT.ARCHIVE.INDEX) - CYLINDERS(1 1) - VOLUMES(SYSDA))
Auditors rarely care about the keyword names FOR and TO; they care whether the implemented retention matches the written records management policy. Export a sample of LISTCAT reports monthly and compare catalog expiration attributes to the spreadsheet or governance database that legal approved. When litigation hold freezes deletion, operators may need to suppress scratch even though FOR or TO suggests eligibility. Those holds are usually tracked outside VSAM entirely, but the catalog still shows the original expiration unless someone ALTERs attributes to reflect the hold—another reason cross-team communication matters. Training beginners to mention retention in design documents—not only in JCL—closes the gap between technical implementation and policy evidence.
Using TO with a date accidentally set in the past can make a cluster immediately eligible for scratch depending on other attributes, which is an exciting way to ruin a go-live. Using FOR with an unrealistically huge number can pin space for years and frustrate capacity reviews. Daylight-saving-time and time-zone issues rarely touch z/OS catalog dates directly, but they do affect operators typing calendar literals under pressure. Always have a second pair of eyes review retention lines in change windows because they are short and easy to overlook compared with huge CYLINDERS clauses that draw attention.
FOR is a timer that starts when you get the toy: "You may keep this toy for thirty days." TO is a calendar circle on the wall: "On this exact day, the toy must go away." Both tell the cleanup crew when it is okay to remove the toy, but one uses a countdown and one uses a date.
1. Which keyword expresses a relative retention length?
2. Which keyword expresses an absolute expiration date?
3. Why must application teams coordinate retention with operations?