Using Commitment Control

This section describes how to use commitment control to process file operations as a group. With commitment control, you ensure one of two outcomes for the file operations:
  • all of the file operations are successful (a commit operation)
  • none of the file operations has any effect (a rollback operation).

In this way, you process a group of operations as a unit.

To use commitment control, you do the following:
  • On the IBM® i:
    1. Prepare for using commitment control:. Use the CL commands CRTJRN (Create Journal), CRTJRNRCV (Create Journal Receiver) and STRJRNPF (Start Journal Physical File).
    2. Notify the IBM i when to start and end commitment control: Use the CL commands STRCMTCTL (Start Commitment Control) and ENDCMTCTL (End Commitment Control). For information on these commands, see the CL and APIs section of the Programming category in the IBM i Information Center at this Web site - http://www.ibm.com/systems/i/infocenter/.
  • In the RPG program:
    1. Specify commitment control (COMMIT) on the file-description specifications of the files you want under commitment control.
    2. Use the COMMIT (commit) operation code to apply a group of changes to files under commitment control, or use the ROLBK (Roll Back) operation code to eliminate the pending group of changes to files under commitment control. For information on how the rollback function is performed by the system, refer to the Recovering your system manual.
Note: Commitment control applies only to database files.