AS/400 Triggers: Batch programs don’t write to trigger file

15 pts.
Tags:
AS/400 administration
AS/400 Parameters
AS/400 triggers
CL batch program
TRIGGER
Trigger failure
I have some triggers set up on our AS/400. A record gets written to a physical file each time one of the triggered files has an add, update or delete performed against it. The problem is that we have a few batch programs that do not write to the trigger file when run (and update and addes are being done via writes and rewrites). The online programs invoke a trigger record, but these specific batch programs do not (writing to the same triggered files).  Both programs are doing basic COBOL writes and rewrites What am I doing wrong? Do I need to set a specific parameter within the batch program?

Software/Hardware used:
AS400
ASKED: May 27, 2011  7:58 PM
UPDATED: June 18, 2013  7:07 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

When you did the ADDPFTRG, you specified what program gets called when action is done to the file. The call the this program will have regardless of how the files is updated (Batch or Interactive).
So I am suspecting that the problem is in your trigger program.
Can you show us the code?

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • JenniferK
    I did not use the ADDPFTRG command when I created the trigger. I just used a Create trigger SQL command. The create command is below. Is that my issue? Should I have done something different? CREATE TRIGGER X4001DATA/PPHISTI AFTER INSERT ON CARSPROD/PPHIST REFERENCING NEW AS N FOR EACH ROW MODE DB2SQL INSERT INTO X4001DATA/F4999P VALUES('PPHIST','I', 'PPJYR=' ||CHAR(N.PPJYR) ||' AND '|| 'PPJDAY =' ||CHAR(N.PPJDAY)||' AND '|| 'PPSEQ =' ||CHAR(N.PPSEQ) ||' AND '|| 'PPSUFX =' ||’’’’’’||CHAR(N.PPSUFX) ||’’’’’’||' AND '|| 'PPPPNO =' ||CHAR(N.PPPPNO)||' AND '|| 'PPADJN =' ||CHAR(N.PPADJN), ' ',CURRENT_TIMESTAMP,CURRENT_TIMESTAMP)
    15 pointsBadges:
    report
  • Mariodlg
    I think you should use ADDPFTRG and write a program to do the inserts, just like CharlieBrown said. Regards.
    2,790 pointsBadges:
    report
  • TomLiotta
    There are two files involved -- CARSPROD/PPHIST and X4001DATA/F4999P. You said: ...we have a few batch programs that do not write to the trigger file when run... To clarify, which of those two files are you referring to when you say "to the trigger file"? Are the batch programs running under commitment control? Do you see any relevant entries in the system audit journal when the batch programs don't work as expected? (Do you have auditing enabled?) Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following