TechTalk: Can a trigger program update the record that causes the trigger condition?

General
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

Q: I have a question regarding an insert/update *BEFORE trigger program written in ILE/C. If I modify the value of a field in the current record in a trigger program, will the modification be written to the database? From what I've read in the manuals, the trigger program can change the value but cannot issue an update.

- Tim Brown

A: You're correct. The OS/400 DB2/400 Database Programming V3R1 manual (SC41-3701, CD-ROM QBKAUC00) says this:

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. The trigger program must not cause the following situations. These situations result in an error if programs run under commitment control.

o Update the same record of the same file that has already been changed by the change operation or by an operation in the trigger program.

o Produce 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.

Note: If the change operation is not running under commitment control, the change operation is always protected. However, updating the same record within the trigger program will not be monitored.

The update to the record cannot be done by the trigger program. It can update or write to other files (for example, audit logs) but not the record the program is being triggered by.

- Peter Rowley

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  •  

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: