IBM AS/400 Frozen Dessert Maker User Manual


 
Using Commitment Control
The default scope for a commitment definition is to the activation group of the
program issuing the STRCMTCTL command, that is, at the activation group level.
Only programs that run within that activation group will use that commitment defi-
nition. OPM programs will use the *DFTACTGRP commitment definition. ILE pro-
grams will use the activation group they are associated with.
You specify the scope for a commitment definition on the commitment scope
(CMTSCOPE) parameter of the STRCMTCTL command. For further information on
the commitment control scope within ILE, refer to "Data Management Scoping" in
ILE Concepts
, and also the
Data Management
manual.
Specifying Files for Commitment Control
To indicate that a DISK file is to run under commitment control, enter the keyword
COMMIT in the keyword field of the file description specification.
When a program specifies commitment control for a file, the specification applies
only to the input and output operations made by this program for this file. Commit-
ment control does not apply to operations other than input and output operations. It
does not apply to files that do not have commitment control specified in the
program doing the input or output operation.
When more than one program accesses a file as a shared file, all or none of the
programs must specify the file to be under commitment control.
Using the COMMIT Operation
The COMMIT operation tells the system that you have completed a group of
changes to the files under commitment control. The ROLBK operation eliminates
the current group of changes to the files under commitment control. For information
on how to specify these operation codes and what each operation does, see the
ILE RPG for AS/400 Reference
.
If the system fails, it implicitly issues a ROLBK operation. You can check the iden-
tity of the last successfully completed group of changes using the label you specify
in factor 1 of the COMMIT operation code, and the notify-object you specify on the
STRCMTCTL command.
At the end of an activation group or job, or when you issue the ENDCMTCTL
command, the OS/400 system issues an implicit ROLBK, which eliminates any
changes since the last ROLBK or COMMIT operation that you issued. To ensure
that all your file operations have effect, issue a COMMIT operation before ending
an activation group or job operating under commitment control.
The OPEN operation permits input and output operations to be made to a file and
the CLOSE operation stops input and output operations from being made to a file.
However, the OPEN and CLOSE operations do not affect the COMMIT and ROLBK
operations. A COMMIT or ROLBK operation affects a file, even after the file has
been closed. For example, your program may include the following steps:
1. Issue COMMIT (for files already opened under commitment control).
2. Open a file specified for commitment control.
3. Perform some input and output operations to this file.
4. Close the file.
Chapter 16. Accessing Database Files 309