Implicit commit and rollback operations
In some instances, a commit or rollback operation is initiated by the system for a commitment definition. These types of commit and rollback operations are known as implicit commit and rollback requests.
Typically, a commit or rollback operation is initiated from an application program using one of the available programming languages that supports commitment control. These types of commit and rollback operations are known as explicit commit and rollback requests.
The following two tables show what the system does when certain events occur related to a commitment definition that has pending changes. A commitment definition has pending changes if any of the following conditions is true:
- Any committable resource has been updated.
- A database file opened under commitment control has been read because reading a file changes the file position.
- The commitment definition has an API resource. Because changes to API resources are done by a user program, the system must assume that all API resources have pending changes.
The C CM (commit operation) journal entry and C RB (rollback operation) journal entry indicate whether the operation was explicit or implicit.
The following table shows the actions the system takes when a job ends, either normally or abnormally, based on the following situations:
- The state of the transaction.
- The action-if-end job value for the commitment definition.
- Whether an API resource is the last agent.
State | Last agent API | Action if Endjob1 option | Commit or rollback operation |
---|---|---|---|
RST | N/A | N/A | If the commitment definition is not associated with an X/Open global
transaction, an implicit rollback is performed. If the commitment definition is associated with an X/Open global transaction, the following events occur:
|
PIP | N/A | N/A | If the commitment definition is not associated with an X/Open global
transaction, an implicit rollback is performed. If the commitment definition is associated with an X/Open global transaction, the transaction branch is in the Idle (S2) state, and it is left in the Idle (S2) state. |
PRP | N/A | WAIT | If the commitment definition is not associated with an X/Open2 global
transaction, the following occurs:
|
PRP | N/A | C | If the commitment definition is not associated with an X/Open2 global transaction, an implicit commit operation is performed. |
R | If the commitment definition is not associated with an X/Open global
transaction, an implicit rollback operation is performed. If the commitment definition is associated with an X/Open global transaction, the following occurs:
|
||
CIP | N/A | N/A | An explicit commit operation is performed. |
LAP | NO | WAIT | 1. Resynchronization to the last agent is used to retrieve the decision to commit or to roll back. |
2. The returned decision to commit or to roll back is performed. It is considered an explicit operation. | |||
LAP | YES | WAIT | 1. The last agent API is called to retrieve the commit or rollback decision. |
2. The commit or rollback operation is performed. It is considered an explicit operation. | |||
LAP | N/A | C | An implicit commit operation is performed. |
R | An implicit rollback operation is performed. | ||
CMT | N/A | N/A | A commit operation has already completed for this commitment definition and any downstream locations. The commit operation is complete. |
VRO | N/A | N/A | The local and remote agents voted to read-only. All downstream agents must also have voted to read-only. No action is required. |
RBR | N/A | N/A | A rollback operation is required. An explicit rollback operation is performed. |
Note:
1 You can change the Action if Endjob option with the Change Commitment Options (QTNCHGCO) API. 2If the commitment definition is associated with an X/Open global transaction, the following events occur:
|
The following table shows the actions the system takes when an activation group ends and applies only to transactions with job-scoped locks. The system actions are based on the following items:
- The state of the transaction. (It is always reset (RST) when an activation group ends.)
- How the activation group ends-normally or abnormally.
- Whether an API resource is the last agent. Note: If an API resource is registered as the last agent, this gives control of the commit or rollback decision to the last agent. The result of the decision is considered an explicit operation
State | Last agent API | Type of end | Commit or rollback operation |
---|---|---|---|
RST | No | Normal | An implicit commit operation is performed. If protected conversations exist, the commitment definition will become the root initiator of the commit operation. |
RST | No | Abnormal | An implicit rollback is performed. |
RST | Yes | Normal | The API exit program is called. The commit or rollback operation is determined by the API. |
RST | Yes | Abnormal | The API exit program is called. The commit or rollback operation is determined by the API. |