When updates are written to databases
The DEDB terms UNDO and REDO are analogous to the DL/I full function terms BACKOUT and COMMIT respectively. However, although the processes that these terms refer to have the similar end results, the processes themselves differ.
The difference is
in the stage at which updates are written to the database. This is shown in Figure 1.
Figure 1. When updates are
written to databases

This difference in timing of writing updates dictates the action taken during the second phase of two-phase commit.
For full function DL/I databases:
- If the phase 2 action is COMMIT, no action is needed to commit updates because DL/I wrote them to the database during phase 1.
- If phase 2 action is ABORT, a BACKOUT of the updates is required because DL/I wrote them to the database during phase 1.
For DEDBs:
- If phase 2 action is COMMIT, the changes must be REDOne to the database because they have only been made in main storage. (They are written (committed) to the database on DASD by the output threads, which are generated by the IMS™ system generation parameter OTHREADS. See IMS: System definition or IMS: System definition for guidance on this parameter.)
- If phase 2 action is ABORT, no changes have to be made to the database, because the changes are still in main storage, and can be UNDOne from there.
REDO is also used to refer to the action required for committed DEDBs during
emergency restart of IMS. IMS can determine from the log that a COMMIT was initiated,
but that phase 2 is not indicated as complete. In this case, DEDB updates
must be REDOne. The two phases are:
- Phase 1, in which CICS® directs syncpoint preparation and asks whether or not the updates to DBCTL databases can be committed.
- Phase 2, in which CICS tells DBCTL that it must either COMMIT or ABORT the resources. (CICS can request an ABORT without first issuing a PREPARE request. That is, CICS can bypass the first phase of two-phase commit when an update is being backed out.)
Figure 2 shows two-phase commit and describes
the activities taking place.
Figure 2. Two-phase commit

Note:
- The syncpoint request can be EXEC CICS SYNCPOINT, a DL/I TERM call, or a CICS task termination.
- If DBCTL indicates that it cannot commit the updates, CICS aborts the unit of recovery and the rest of the Figure 2 does not apply.
- If CICS tells DBCTL to commit the updates, DBCTL must commit.
- At this stage, units of recovery are in-flight and, if DBCTL fails, all database updates are aborted.
- At this stage, from the time that DBCTL issues its response to the PREPARE request to the time it receives a COMMIT request from CICS, units of recovery are indoubt. DBCTL retains the indoubt information. When DBCTL is restarted after a failure, it inquires with CICS about the status of the in-doubts. This is part of resynchronization.