IBM AS/400 User Manual

Page of 489
 
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
DISK
COMMIT(COMITFLAG)
FTRANS
UF
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.
*ENTRY
PLIST
PARM
COMITFLAG
:
:
 *
 *
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')
 *
UPDATE
MAST_REC
90
UPDATE
TRAN_REC
91
C
IF
COMITFLAG = '1'
C
IF
*IN90 OR *IN91
ROLBK
ELSE
COMMIT
ENDIF
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.
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