Most commitment control issues that affect DB2 programs are the same as those for native databases. This section discusses some differences.
DB2 databases are recoverable resources. If your program makes changes to a DB2 table and the program was prepared with commitment control (COMMIT parameter not equal to *NONE on the CRTSQLCBLI (Create SQL ILE COBOL object) command), the changes are committed to the database. The changes are committed to the database when the job or the activation group ends or when an implicit or explicit EGL commit occurs. For more information on implicit and explicit commitment control, see Considerations for iSeriesC database commitment control
The CMTSCOPE (commit scope) parameter on the STRCMTCTL (start commitment control) command defines the scope of commitment control to be *JOB or *ACTGRP. When the first SQL statement runs, DB2 issues the STRCMTCTL command if it has not already been issued. Likewise, when the commit scope is complete, DB2 issues the ENDCMTCTL (end commitment control) command. If your program ends abnormally before the end of the logical unit of work (LUW) or before an explicit EGL rollback is requested, all changes that were made since the beginning of the LUW are backed out.
Commitment control for EGL DB2 programs is controlled through the COMMIT parameter on the CRTSQLCBLI command. If *NONE is specified, the program does not run under commitment control. *NONE must be specified if the EGL program issues the SQL DROP COLLECTION, GRANT, or REVOKE commands in an execute statement.
The default value for the COMMIT parameter in the EGL DB2 preparation script FDAPREP is *CHG. You can modify this script so that a user symbolic parameter (symparm) establishes the commit value during EGL program generation. This script modification enables easy variations of the COMMIT value among multiple programs. For information on modifying scripts, see the EGL Generation Guide. Commitment control using DB2 is no different from commitment control using native database files except as noted here.