DDM Files
Figure 156 on page 312 is an example showing conditional commitment control.
*.. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... *
FFilename++IPEASFRlen+LKlen+AIDevice+.Keywords+++++++++++++++++++++++
FMASTER UF E K DISK COMMIT(COMITFLAG)
FTRANS UF E K DISK COMMIT(COMITFLAG)
*.. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... *
CL0N01Factor1+++++++Opcode(E)+Factor2+++++++Result++++++++Len++D+HiLoEq....
* If COMITFLAG = '1' the files are opened under commitment control,
* otherwise they are not.
C *ENTRY PLIST
C PARM COMITFLAG
C :
C :
*
* Use the COMMIT operation to complete a group of operations if
* they were successful or rollback the changes if they were not
* successful. You only issue the COMIT or ROLBK if the files
* were opened for commitment control (ie. COMITFLAG = '1')
*
C UPDATE MAST_REC 90
C UPDATE TRAN_REC 91
C IF COMITFLAG = '1'
C IF *IN90 OR *IN91
C ROLBK
C ELSE
C COMMIT
C ENDIF
C ENDIF
C*
Figure 156. Example of Using Conditional Commitment Control
Commitment Control in the Program Cycle
Commitment control is intended for full procedural files, where the input and output
is under your control. Do not use commitment control with primary and secondary
files, where input and output is under the control of the RPG program cycle. The
following are some of the reasons for this recommendation:
You cannot issue a COMMIT operation for the last total output in your program.
It is difficult to program within the cycle for recovery from a locked-record condi-
tion.
Level indicators are not reset by the ROLBK operation.
After a ROLBK operation, processing matching records may produce a
sequence error.
DDM Files
ILE RPG programs access files on remote systems through distributed data man-
agement (DDM). DDM allows application programs on one system to use files
stored on a remote system as database files. No special statements are required in
ILE RPG programs to support DDM files.
A DDM file is created by a user or program on a local (source) system. This file
(with object type *FILE) identifies a file that is kept on a remote (target) system.
312 ILE RPG for AS/400 Programmer's Guide