Commitment Control

The IBM i operating system provides a facility called "commitment control" that allows programs to define database transaction boundaries.

When a database transaction is in progress, all changes to the database are considered to be "temporary" until the transaction boundary is reached. At the boundary, the program may choose to COMMIT the changes to the database, or ROLLBACK the changes to the last completed transaction boundary (thus removing them from the database).

If the job should end before reaching the transaction boundary, the operating system will automatically ROLLBACK to the last completed transaction boundary, thus removing any incomplete transactions from the database. For interactive jobs, the job begins when the user signs on and finishes with the job ending abnormally, or the user signing off.

It is possible to define and use database files within LANSA that are under IBM i commitment control. However, before doing this you should consider the following points:

If the commitment control options available when setting up a file definition are used, they specify that a file is under commitment control all the time in all applications. In this situation, the starting and ending of commitment control is the responsibility of the programmer.

*PGMCOMMIT

To selectively use commitment control within just one function, you can use the FUNCTION OPTIONS(*PGMCOMMIT) command to specify function level commitment control is required. When this option is used, all files subject to modification by the function are automatically placed under commitment control. Commitment control is automatically started and ended by the program. All individual file definition options regarding commitment control are overridden and superseded when using this option.

Under certain circumstances, LANSA automatically starts and ends commitment control using User Exit F@BGNCMT - Start Commitment Control and User Exit F@ENDCMT - End Commitment Control. This happens for: