IBM Support

Recursion in Trigger Programs

Troubleshooting


Problem

This document discusses the history of recursion capability in trigger programs.

Resolving The Problem

For V4R4 and later releases, the IBM® DB2® UDB for iSeries Database Programming manual reports the following on trigger program usage (the specific excerpt is from the V5R1 version of the manual):

DB2 UDB for iSeries Database Programming V5R1

Commands, statements, and operations that cannot be used in trigger programs: A trigger program calls other programs or it can be nested (that is, a statement in a trigger program causes the calling of another trigger program). In addition, a trigger program can call a trigger program. The maximum trigger nested level for insert, update, delete, or read is 200. When the trigger program runs under commitment control, the following situations result in an error:

oAny update of the same record that has already been changed by the change operation or by an operation in the trigger program.
oConflicting operations on the same record within one change operation. For example, the change operation inserts a record and is then deleted by the trigger program.
Up to V4R3, an excerpt from the same manual mentioned recursion in trigger programs as shown below:

A trigger program can call other programs or can be nested (that is, a statement in a trigger program causes the calling of another trigger program). In addition, a trigger program may be called recursively by itself. The maximum trigger nested level for insert and update is 200. When the trigger program runs under commitment control, the following situations result in an error.
oAny update of the same record that has already been changed by the change operation or by an operation in the trigger program.
oProduce conflicting operations on the same record within one change operation. For example, a record is inserted by the change operation and then deleted by the trigger program.
It should be noted that the ability of the trigger programs to perform recursive calls, directly or indirectly, is language-dependent. The following table covers the more common languages on the system:


OPM RPGILE RPGOPM COBOLILE COBOLILE C
Program recursion allowed?NoNo
(recursion allowed only for subprocedures)
NoNoYes
(recursion allowed for programs and functions)

[{"Type":"MASTER","Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"Platform":[{"code":"PF012","label":"IBM i"}],"Version":"6.1.0"}]

Historical Number

24841857

Document Information

More support for:
IBM i

Software version:
6.1.0

Operating system(s):
IBM i

Document number:
640841

Modified date:
18 December 2019

UID

nas8N1017209

Manage My Notification Subscriptions