× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: triggers
  • From: "Chuck Morehead" <cbmorehead@xxxxxxxxxx>
  • Date: Wed, 11 Jul 2001 07:46:06 -0500
  • Organization: Nokuse Consutling

Angie,

Trigger programs do require special parameters.  They give all sorts of info
about the record that was added/modified/deleted.

I remembered reading an excellent article on triggers a few years back, so I
checked out the News/400 archives.  I found an interesting article where
Chris Stead wrote a generic trigger program,
http://www.as400network.com/artarchive/index.cfm?fuseaction=viewarticle&CO_C
ontentID=1731.  This may help you, as you can download the source and play
with it to see how someone else has done it.  Also, IMHO it is much easier
to write trigger programs in ILE (RPG or C) than in CL or traditional
RPG/400.

Chuck


----- Original Message -----
From: Angela Wawrzaszek
To: 'Midrange Mail List (E-mail)'
Sent: Wednesday, July 11, 2001 6:54 AM
Subject: triggers


I am finally having to use triggers,  we have a package software so it
wasn't something we used before.  However I am trying to create some new
files and the idea of Triggers to kick off an update sounded good.

What I have is an AS/400 file that is updated via the web,  it is for order
entry.  When the file gets updated/created on the web I fire off the trigger
program.  The trigger program actually is a CL that checks a logical over
the order file to see if there is any records within the file with a status
of A or C,  if so it calls an RPG program to update our real order entry
files on our BPCS package.  The problem I have is our actual order entry
program on BPCS,  I modified this to also add/change/delete records off of
this web file when changes are made through the order entry program.  So
when a record is added on BPCS,  I call a CL that does some overrides and
then calls the RPG program to add it to the web file.

NUC500C is the CL,  I am telling it to add order# 109820 to the web file.
As soon as it adds the record the trigger is fired off and fails.  If I
re-call this same command it works file because I am no longer doing an
insert on the file.  I have the trigger set for all three conditions
insert, update or delete.  I really do not even need the trigger program to
run when it is updated from our BPCS system.  That is why I did the CL to
see if any records existed with an A or C status meaning they were FROM the
web.

 call nuc500c ('109820' 'A')
    815 - OVRDBF FILE(ECHQTE) TOFILE(ECHL02) MBR(QUOTE)
    816 - OVRDBF FILE(ECLQTE) TOFILE(ECLA08) MBR(QUOTE)
    817 - OVRDBF FILE(ESNQTE) TOFILE(ESNL01) MBR(QUOTE)
    819 - CALL PGM(NUC500)          /* The CALL command contains parameters
   */
 Error occurred in trigger program.
 C
 Error occurred in trigger program.
 C
 An error in the trigger program was detected after WRITE on file ORDERS.
 Function check. RNX1024 unmonitored by NUC500 at statement 0000001427,
   instruction X'0000'.
 An error in the trigger program was detected after WRITE on file ORDERS (C
                                                                    More...
ss Enter to continue.


ssage ID . . . . . . :   CPF502B       Severity . . . . . . . :   30
ssage type . . . . . :   Sender copy
te sent  . . . . . . :   07/06/01      Time sent  . . . . . . :   15:37:45

ssage . . . . :   Error occurred in trigger program.
use . . . . . :   The trigger program which was called as the result of a
database insert, update, or delete operation failed. See the previous
messages in the job log to determine the error. The error code is 2. This
error code can be used to determine the trigger which caused the error, as
follows:
  1 -- *BEFORE *INSERT trigger
  2 -- *AFTER *INSERT trigger
  3 -- *BEFORE *UPDATE trigger
  4 -- *AFTER *UPDATE trigger
  5 -- *BEFORE *DELETE trigger



*********************************

If I add/change the file through a DFU and put the   code of  A or C which
should kick off the trigger I get the message CPF502B.  It is saying the
number of parms passed does not match.  The trigger program NUC500c1
requires NO parms!

I can change/update the file with the trigger removed and then call the
trigger program and everything works fine.



HELP!!!


Angie Wawrzaszek
M.I.S. Department

+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@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 ...

Replies:

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.