Not every file change is a READ-WRITE on one employee row. Month-end sometimes replaces an entire extract: new sequential file, new GDG generation, or reloaded VSAM cluster built from authoritative source. Replacing records in Easytrieve means mass output—JOB INPUT the golden source, transform if needed, PUT or WRITE to CREATE output until EOF, verify counts, then operations swaps the dataset in catalog or JCL PROC. In-place update tutorials cover keyed maintenance; this page covers full refresh semantics, when replace beats update, backup and reconciliation discipline, sequential versus KSDS reload paths, SORT-before-reload ordering, FILE-STATUS on every PUT, and coordination with IDCAMS REPRO when Easytrieve is extract only. Beginners who PUT to DISP=OLD production without backup learn painful lessons—treat replace jobs as production change events, not casual report runs.
| Strategy | Scope | Typical verbs |
|---|---|---|
| Update | One or few existing rows | READ, MOVE, WRITE |
| Append | Add rows at end | PUT, WRITE ADD |
| Replace | Entire file contents new | CREATE output, PUT all rows |
| Delete | Remove rows | WRITE DELETE paths |
1234567891011121314FILE SOURCE SEQUENTIAL FB(200 2000) FILE NEWFILE FB(200 2000) CREATE DEFINE SOURCE * layout DEFINE NEWFILE * same layout JOB INPUT SOURCE MOVE SOURCE-FIELDS TO NEWFILE-FIELDS PUT NEWFILE STATUS IF FILE-STATUS NE 0 STOP END-IF
JCL allocates NEWFILE DISP=(NEW,CATLG,DELETE) or writes to generation in GDG base. After successful run, operations point production JCL to new DSN or roll GDG. SOURCE may be DB2 extract, corrected master, or SORT output. Row count in FINISH must match control totals.
Replacing KSDS rarely uses millions of individual WRITE updates. Common pattern: unload or extract all rows, SORT by key, PUT or mass insert into new cluster defined with IDCAMS, REPRO or DEFINE in ops runbook, swap cluster name. Easytrieve FILE NEWMAST INDEXED CREATE with UPDATE and sorted JOB INPUT PUT loads consecutive keyed records when release supports mass insertion. Duplicate keys in source must be resolved before reload—SORT with duplicate handling or validation ERRFILE.
KSDS reload expects key order. SORT activity or external DFSORT step orders source before PUT. Unsorted reload into KSDS causes load failures or silent key disorder depending on path. Document key fields in SORT statement matching INDEXED DEFINE key position.
CREATE on FILE builds new dataset. RESET on FILE may zero numeric fields on read for input validation during transform. Output DEFINE should receive explicit MOVE for every business field—do not rely on uninitialized buffer on PUT. Variable-length output needs RECORD-LENGTH before each PUT per appending chapter.
Production replace runbook: backup current DSN or GDG rollback point; run Easytrieve replace to new dataset; compare record counts and checksum samples; IDCAMS PRINT or compare utility; rename or alter catalog alias to cut over; retain backup retention per policy. Easytrieve finishes when PUT completes—cutover is operations governance.
STATUS on every PUT in replace loops. STOP or branch on non-zero FILE-STATUS—partial replace is worse than failed job with old file intact. FINISH displays input count, output count, rejected count. Control file from upstream must match within tolerance. Automate mismatch alert to on-call before swap.
Define GDG base in JCL; each replace run creates new generation (+1). Consumers coded with (0) or relative generation receive latest after successful create. Easytrieve FILE does not manage GDG—JCL DD DSN=BASE.GDG(+1) does. Replacing via GDG preserves history for audit rollback.
Updating is erasing one wrong word in your notebook. Appending is adding a new page at the back. Replacing is ripping out the whole notebook and binding a brand-new one with all pages rewritten. You keep a photocopy of the old notebook (backup) and count pages (reconciliation) before giving everyone the new notebook.
1. Replacing an entire file usually means:
2. In-place salary fix uses:
3. CREATE on output FILE allows:
4. Before replacing production master you should:
5. PUT reload from sorted input is common for: