Report writers read files; production systems also change them—salary adjustments, status codes, balance corrections, slot flags. Easytrieve updating is not a single mystery verb; it is FILE UPDATE authority, correct JCL disposition, retrieving the target record into the buffer with READ or GET HOLD, modifying DEFINE fields, and applying WRITE to commit the new image in place on VSAM KSDS or RRDS. Batch and CICS differ on HOLD defaults. Beginners copy read-only JOB INPUT examples then wonder why WRITE fails: UPDATE was missing on FILE or DISP was SHR while another job held exclusive use. This page walks the full update lifecycle, compares browse-and-update with keyed READ-update, explains NOHOLD overrides, documents FILE-STATUS error branches, and contrasts updating with appending sequential output via PUT. Master indexed and relative file pages before changing production masters.
| Requirement | Where set | Why it matters |
|---|---|---|
| FILE UPDATE | Library FILE statement | Authorizes update verbs |
| Correct FILE type | INDEXED or RELATIVE for VSAM | QSAM not in-place rewrite |
| JCL disposition | DD DISP OLD or approved SHR | Avoid record lock conflicts |
| Password if needed | FILE PASSWORD | VSAM cluster security |
| Record in buffer | READ or GET HOLD | WRITE rewrites current buffer |
123456FILE PAYMAST INDEXED UPDATE FB(250 1800) DEFINE PAYMAST EMP-KEY 9 1 SALARY P 9.2 10 STATUS A 1 20
UPDATE on FILE tells Easytrieve and the access method that maintenance verbs are allowed. For SQL files, UPDATE means columns marked updatable can change and DELETE/INSERT paths need it. For VSAM, combine with appropriate OPEN mode implied by first verb. CREATE is separate— building new datasets—not the same as rewriting existing slots.
Two dominant patterns exist. Keyed update: MOVE key from transaction to master key field, READ master STATUS, branch on not-found, MOVE new salary or status into buffer fields, WRITE master STATUS. Browse update: JOB INPUT on indexed master with UPDATE so each GET HOLD loads next record, IF logic decides change, MOVE fields, WRITE, loop continues. Pick keyed when input file drives sparse updates; pick browse when every master record needs inspection.
12345678910111213141516171819202122FILE CHANGES SEQUENTIAL FB(40 27920) FILE PAYMAST INDEXED UPDATE FB(250 1800) DEFINE CHANGES C-EMP 9 1 C-NEW P 9.2 10 DEFINE PAYMAST EMP-KEY 9 1 SALARY P 9.2 10 JOB INPUT CHANGES MOVE C-EMP TO EMP-KEY READ PAYMAST STATUS IF NOT PAYMAST PUT ERRFILE EXIT END-IF MOVE C-NEW TO SALARY WRITE PAYMAST STATUS IF FILE-STATUS NE 0 PUT ERRFILE END-IF
Outside CICS, when FILE has UPDATE, Easytrieve may automatically hold records during GET so rewrite is possible. HOLD on GET explicitly requests hold; invalid without UPDATE. NOHOLD overrides automatic hold for read-only pass through same FILE declaration in another activity. In CICS, default is NOHOLD; HOLD prevents browse GET—use READ to retrieve for update. Mixing online and batch examples without noting environment causes production surprises.
WRITE file-name applies the current buffer image to the record positioned or held in that file. STATUS sets FILE-STATUS for branch on duplicate key, authority, or I/O errors. WRITE is not for appending new sequential QSAM rows—that is PUT on output FILE. Confusing WRITE and PUT is a frequent maintenance bug. After failed WRITE, do not assume the master still matches buffer—re-READ before retry.
| Environment | Default hold on GET | Typical update retrieve |
|---|---|---|
| Batch z/OS | HOLD when FILE UPDATE | GET HOLD or READ |
| CICS online | NOHOLD default | READ for update |
DISP=SHR allows readers while updaters may need careful SHAREOPTIONS on VSAM define. Exclusive DISP=OLD suits nightly batch refresh. Long-held records during GET HOLD block other updaters on same row—minimize logic between GET and WRITE. FINISH procedures should not leave files in ambiguous hold state; CLOSE when activity ends releases resources.
Always branch on STATUS after READ and WRITE in maintenance jobs. Write rejected records to sequential ERRFILE with PUT for reconciliation. Count successes in working storage; compare FINISH totals to input control counts. DUPLICATE on rewrite may mean logic error or duplicate key cluster definition—do not retry blindly in a loop.
Updating changes existing rows in place on VSAM. Appending adds new rows at end of sequential or ESDS via PUT without prior READ. Replacing entire file content may use output sequential CREATE plus PUT from transformed input—different chapter. Salary correction is update; monthly new-hire extract to interface file is append.
SQL FILE with UPDATE allows changing defined columns; FILE without UPDATE limits which columns change. DELETE and INSERT need UPDATE and DBMS grants. SQL maintenance often uses embedded SQL verbs rather than VSAM WRITE—see SQL file chapter when DB2 is the target, not KSDS.
Updating is erasing something on a worksheet and writing a new number in the same box—not adding a brand-new page at the back. First you must open the right workbook (READ), find the right row (key), change the pencil marks in your copy (MOVE to buffer fields), then press save on that row (WRITE). UPDATE is permission to save. If someone else locked the workbook (JCL or sharing), save fails and you write the problem in an error diary (ERRFILE).
1. UPDATE on FILE is required to:
2. In batch, GET HOLD with FILE UPDATE:
3. CICS online default for GET hold is:
4. After changing buffer fields you typically:
5. JCL DISP for exclusive update often uses: