Module 13: CICS Recovery, Restart and Production Support
CICS Recovery
CICS recovery is the set of facilities that protects your data when a task fails or the CICS region stops. It guarantees that changes to recoverable resources are either fully completed or fully backed out - never left half-done.

What is CICS recovery
- Recovery makes every unit of work atomic: all of its changes are committed together, or all are backed out together.
- Before CICS applies a change to a recoverable resource, it writes a journal (log) record describing the change.
- If the task or the region fails, the CICS recovery manager uses the journal to undo incomplete work and redo committed work.
- Recovery works across resource types - VSAM files, temporary storage, transient data and DB2 tables can all be recovered as one unit.
Recoverable resources
- A VSAM file is recoverable only when its resource definition specifies recovery (RECOVERY attribute); otherwise CICS cannot back out its updates.
- Temporary storage queues and transient data queues can be defined as recoverable so their updates are journalled.
- DB2 tables accessed through CICS are recoverable and are coordinated with CICS by the two-phase commit protocol.
- Non-recoverable resources are faster but risky: a failure in the middle of updates leaves the data inconsistent and must be fixed manually.
How CICS performs recovery
- During normal running, every update to a recoverable resource is journalled with a before-image and an after-image of the record.
- When a task abends, dynamic transaction backout automatically undoes that task's changes while CICS keeps running.
- When the whole region fails, emergency restart reads the system log, backs out in-flight units of work and completes the ones that were committed.
- Example - a program that updates two accounts and commits them as one unit of work:-3000-UPDATE-ACCOUNTS.
EXEC CICS
READ FILE('ACCTMAS') INTO(ACCT-RECORD)
RIDFLD(ACCT-NO-1) UPDATE
END-EXEC.
SUBTRACT TRANSFER-AMT FROM ACCT-BALANCE.
EXEC CICS
REWRITE FILE('ACCTMAS') FROM(ACCT-RECORD)
END-EXEC.
*-- read and update the second account the same way
EXEC CICS
SYNCPOINT
END-EXEC. - If the task abends before the SYNCPOINT, both account updates are backed out and the balances stay consistent.
