• Subject: RE: Recursive Triggers
  • From: Joe Teff <jteff19@xxxxxxx>
  • Date: Tue, 12 May 1998 23:59:28 -0500

> 1.-    I read in the v4r2 DB2/400 Programming Book that Recursive
>        Triggers are supported and the maximum number of recursions is 200
>
>        Question: Is this Recursion Supported in V3R2 and if it is
>                            what is the maximum number of recursions ?

I don't use recursive triggers. Seems like a great way to get in trouble and 
there
are better ways to handle updating the same record.

> 2.-   Because of the nature of the recursion ... Do I need to create
>        an ILE program ?
>
>        Is there a  Simple *AFTER Update, Recursive Trigger
>        Example anywhere ?

> 3.-   I Only Need 1 Level Of Recursion........
>        I have contemplated to have a *DTAQ  BATCH program
>         running in the background to simulate the Recursive
>         Update. Is there any problems with this approach ?

> 4.-   Can I Just simply Update the NEW_RCD area
>          in the *BEFORE Update Trigger and let the
>          *AFTER Update Trigger Occur, eliminating the need for recursion ?
>
>  Thanks for your response.

When I need to change the same record that caused the trigger yo fire, I use a
*BEFORE *INSERT or *BEFORE *UPDATE trigger. By changing the after portion
of the buffer, your change is applied in the same update as the change that 
fired
the trigger.

A couple of notes.
   I always set my *UPDATE triggers to only fire when the record is actually 
changed
     (this is a parameter on the ADDPFTRG command).
   I always use code at the beginning of my trigger to decide if the conditions 
are
      right for the trigger to run. If not, then I exit immediately.
   All of my triggers are RPG/ILE with the Activation Group of QILE.
   I exit my program with *INLR turned off for performance reasons on 
repetitive calls.

+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.