What is Commitment Control?
Commitment control is a function that ensures data integrity. It defines and processes a group of changes to resources, such as database files or tables, as a transaction.
Commitment control ensures that either the entire group of individual changes occur on all systems that participate or that none of the changes occur. IBM® DB2 Universal Database™ for iSeries™ uses the commitment control function to commit and rollback database transactions that are running with an isolation level other than *NONE (No Commit).
You can use commitment control to design an application so that the system can restart the application if a job, an activation group within a job, or the system ends abnormally. With commitment control, you can have assurance that when the application starts again, no partial updates are in the database due to incomplete transactions from a prior failure.
A program that implements the function runs under i OS Commitment Control and, if so, whether it contains the main commit points. i OS commitment control provides a means of automatically grouping a number of database updates into a single transaction for the purposes of recovery: either all or none of the updates take place.
Commitment control ensures that either the entire group of individual changes occurs on all systems that participate or that none of the changes occur.
The *COMMIT built-in function enables you to add your own commit points to a program that is executing under IBMi commitment control. Commitment control is a method of grouping database file operations that allow the processing of a database change to be either fully processed (COMMIT) or fully removed (ROLLBACK).
Implementing Commitment Control in 2E
CA 2E implements the *COMMIT built-in function as an RPG COMMIT statement, and as a COBOL COMMIT statement.
There are two types of functions used in Commitment Control.
The Master function. This function is an external function defined with the function Option:Commit control = M. The master function is a parent function of a transaction. It is used to define the beginning and ending of the transaction.
The Slave function. This function is an external function that is contained within the transaction. It is defined by the function Option: Commit control = S. The Slave is part of a transaction controlled the the parent Master function.
Using Commitment Control in CA 2E
- Setup files with jounaling to use Commitment Control.
- Start with a Master.
- Enter a *commit at beginning of transaction.
- Enter a *commit at end of transaction.
- Enter *rollback if transaction fails.
- Master can contain multiple slave functions.
- Slaves cannot exist in a transaction without a master.