trigger program error - IBM AS400

This is a discussion on trigger program error - IBM AS400 ; Hi. Customer needs to add a trigeer on one of tables. Trigger must be fired after insert to table (1) and call external program which makes some inserts on another table (2). They wrote a simple program in php (we ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: trigger program error

  1. trigger program error

    Hi.

    Customer needs to add a trigeer on one of tables.
    Trigger must be fired after insert to table (1) and call external
    program which makes some inserts on another table (2).

    They wrote a simple program in php (we use zend core env.) which makes
    insert into table (2).
    So, I've created CL to call this qshell program.
    When I run this CL data is inserted to table (2). When I do insert on
    (1) and run my CL the same data is inserted into (2). So I soppose it
    works as it should.

    I used ADDPFTRG to add trigger:
    event - *INSERT
    time - *AFTER

    Now, when I do insert in (1) I get error:
    Error occurred in trigger program.
    Trigger program or external routine detected an error.

    and details:
    Cause . . . . . : The trigger program which was called as the result
    of a
    database insert, update, delete, or read operation failed. See the
    previous
    messages in the job log to determine the error. The failing trigger
    program
    is CWSTSPF in library CWTOSTLIB type *SYS. The failing trigger is
    defined
    on file DOSSTSPF in library TEMP0709.

    Recovery . . . : Correct the error in the trigger program. Then try
    your
    request again.


    and


    Message . . . . : Trigger program or external routine detected an
    error.


    Cause . . . . . : Either a trigger program, external procedure, or
    external
    function detected and returned an error to SQL. If the error occurred
    in a
    trigger program, the trigger was on table DOSSTSPF in schema
    TEMP0709. If
    the error occurred in an external procedure or function, the external
    name
    is DOSSTSPF in schema TEMP0709. The associated text is *AFTER
    *INSERT. If
    the error occurred in a trigger program, the associated text is the
    type of
    trigger program. If the error occurred in an external function, the

    associated text is the text of the error message returned from the
    external
    function.



    Does anybody has any idea why doesn't it work ?

    Regards,
    Tomasz

  2. Re: trigger program error

    il 07/09/2007 10.42, Scrive tomasz 40646240:
    > Hi.
    >
    > Customer needs to add a trigeer on one of tables.
    > Trigger must be fired after insert to table (1) and call external
    > program which makes some inserts on another table (2).
    >
    > They wrote a simple program in php (we use zend core env.) which makes
    > insert into table (2).
    > So, I've created CL to call this qshell program.
    > When I run this CL data is inserted to table (2). When I do insert on
    > (1) and run my CL the same data is inserted into (2). So I soppose it
    > works as it should.
    >
    > I used ADDPFTRG to add trigger:
    > event - *INSERT
    > time - *AFTER
    >
    > Now, when I do insert in (1) I get error:
    > Error occurred in trigger program.
    > Trigger program or external routine detected an error.
    >
    > and details:
    > Cause . . . . . : The trigger program which was called as the result of a
    > database insert, update, delete, or read operation failed. See the
    > previous
    > messages in the job log to determine the error. The failing trigger
    > program
    > is CWSTSPF in library CWTOSTLIB type *SYS. The failing trigger is
    > defined
    > on file DOSSTSPF in library TEMP0709.
    > Recovery . . . : Correct the error in the trigger program. Then try your
    > request again.


    > Does anybody has any idea why doesn't it work ?

    Can be anything that cause the program to fail, e.g. a wrong parameter
    list, some condition that cause an exception inside the program itself
    and so on. Try debugging the trigger program.
    If the trigger does simple things, as logging the record to be inserted
    in an other file or checking field consistensy, generally speaking it
    does somewhat that can be written by SQL language, I'd suggest to
    create the trigger by SQL (CREATE TRIGGER sql statement).



    --
    Dr.Ugo Gagliardelli,Modena,ItalyCertifiedUindoscrasherAñe joAlcoolInside
    Spaccamaroni andate a cagare/Spammers not welcome/Spammers vão à merda
    Spamers iros a la mierda/Spamers allez vous faire foutre/Spammers loop
    schijten/Spammers macht Euch vom Acker/Spamerzy wypierdalac'

  3. Re: trigger program error

    On Sep 7, 9:42 am, tomasz wrote:
    > Hi.
    >
    > Customer needs to add a trigeer on one of tables.
    > Trigger must be fired after insert to table (1) and call external
    > program which makes some inserts on another table (2).
    >
    > They wrote a simple program in php (we use zend core env.) which makes
    > insert into table (2).
    > So, I've created CL to call this qshell program.
    > When I run this CL data is inserted to table (2). When I do insert on
    > (1) and run my CL the same data is inserted into (2). So I soppose it
    > works as it should.
    >
    > I used ADDPFTRG to add trigger:
    > event - *INSERT
    > time - *AFTER
    >
    > Now, when I do insert in (1) I get error:
    > Error occurred in trigger program.
    > Trigger program or external routine detected an error.
    >
    > and details:
    > Cause . . . . . : The trigger program which was called as the result
    > of a
    > database insert, update, delete, or read operation failed. See the
    > previous
    > messages in the job log to determine the error. The failing trigger
    > program
    > is CWSTSPF in library CWTOSTLIB type *SYS. The failing trigger is
    > defined
    > on file DOSSTSPF in library TEMP0709.
    >
    > Recovery . . . : Correct the error in the trigger program. Then try
    > your
    > request again.
    >
    > and
    >
    > Message . . . . : Trigger program or external routine detected an
    > error.
    >
    > Cause . . . . . : Either a trigger program, external procedure, or
    > external
    > function detected and returned an error to SQL. If the error occurred
    > in a
    > trigger program, the trigger was on table DOSSTSPF in schema
    > TEMP0709. If
    > the error occurred in an external procedure or function, the external
    > name
    > is DOSSTSPF in schema TEMP0709. The associated text is *AFTER
    > *INSERT. If
    > the error occurred in a trigger program, the associated text is the
    > type of
    > trigger program. If the error occurred in an external function, the
    >
    > associated text is the text of the error message returned from the
    > external
    > function.
    >
    > Does anybody has any idea why doesn't it work ?
    >
    > Regards,
    > Tomasz


    If you use addpftrg then the db passes 2 parameters to your program.
    The 1st contains the trigger data & the 2nd is the length of the 1st.
    If you coded a CL program then you must accept exactly 2 parms. Type
    DSPPGM progname & page down twice you will see the number of
    parameters. Either accept dummy parameters to make up the number or
    change to CLLE. Doing DSPPGM on CLLE shows a min & max number of
    parameters which may be passed.

    HTH
    Jonathan.


  4. Re: trigger program error

    Hi.

    Many thanks for help.
    I've used SQL CREATE TRIGGER and it's working as it should work !!!
    As usually your advice was very helpfull.

    Regards,
    Tomasz


    Dr.UgoGagliardelli pisze:
    > il 07/09/2007 10.42, Scrive tomasz 40646240:
    >> Hi.
    >>
    >> Customer needs to add a trigeer on one of tables.
    >> Trigger must be fired after insert to table (1) and call external
    >> program which makes some inserts on another table (2).
    >>
    >> They wrote a simple program in php (we use zend core env.) which makes
    >> insert into table (2).
    >> So, I've created CL to call this qshell program.
    >> When I run this CL data is inserted to table (2). When I do insert on
    >> (1) and run my CL the same data is inserted into (2). So I soppose it
    >> works as it should.
    >>
    >> I used ADDPFTRG to add trigger:
    >> event - *INSERT
    >> time - *AFTER
    >>
    >> Now, when I do insert in (1) I get error:
    >> Error occurred in trigger program.
    >> Trigger program or external routine detected an error.
    >>
    >> and details:
    >> Cause . . . . . : The trigger program which was called as the result
    >> of a
    >> database insert, update, delete, or read operation failed. See the
    >> previous
    >> messages in the job log to determine the error. The failing trigger
    >> program
    >> is CWSTSPF in library CWTOSTLIB type *SYS. The failing trigger is
    >> defined
    >> on file DOSSTSPF in library TEMP0709.
    >> Recovery . . . : Correct the error in the trigger program. Then try
    >> your
    >> request again.

    >
    >> Does anybody has any idea why doesn't it work ?

    > Can be anything that cause the program to fail, e.g. a wrong parameter
    > list, some condition that cause an exception inside the program itself
    > and so on. Try debugging the trigger program.
    > If the trigger does simple things, as logging the record to be inserted
    > in an other file or checking field consistensy, generally speaking it
    > does somewhat that can be written by SQL language, I'd suggest to
    > create the trigger by SQL (CREATE TRIGGER sql statement).
    >
    >
    >


  5. Re: trigger program error

    Hi.

    Thanks for info. I didn't realize that.
    This time SQL CREATE TRIGGER was good enough but I also try with
    ADDPFTRG.

    Tomasz


    Jonathan Bailey pisze:
    > On Sep 7, 9:42 am, tomasz wrote:
    >> Hi.
    >>
    >> Customer needs to add a trigeer on one of tables.
    >> Trigger must be fired after insert to table (1) and call external
    >> program which makes some inserts on another table (2).
    >>
    >> They wrote a simple program in php (we use zend core env.) which makes
    >> insert into table (2).
    >> So, I've created CL to call this qshell program.
    >> When I run this CL data is inserted to table (2). When I do insert on
    >> (1) and run my CL the same data is inserted into (2). So I soppose it
    >> works as it should.
    >>
    >> I used ADDPFTRG to add trigger:
    >> event - *INSERT
    >> time - *AFTER
    >>
    >> Now, when I do insert in (1) I get error:
    >> Error occurred in trigger program.
    >> Trigger program or external routine detected an error.
    >>
    >> and details:
    >> Cause . . . . . : The trigger program which was called as the result
    >> of a
    >> database insert, update, delete, or read operation failed. See the
    >> previous
    >> messages in the job log to determine the error. The failing trigger
    >> program
    >> is CWSTSPF in library CWTOSTLIB type *SYS. The failing trigger is
    >> defined
    >> on file DOSSTSPF in library TEMP0709.
    >>
    >> Recovery . . . : Correct the error in the trigger program. Then try
    >> your
    >> request again.
    >>
    >> and
    >>
    >> Message . . . . : Trigger program or external routine detected an
    >> error.
    >>
    >> Cause . . . . . : Either a trigger program, external procedure, or
    >> external
    >> function detected and returned an error to SQL. If the error occurred
    >> in a
    >> trigger program, the trigger was on table DOSSTSPF in schema
    >> TEMP0709. If
    >> the error occurred in an external procedure or function, the external
    >> name
    >> is DOSSTSPF in schema TEMP0709. The associated text is *AFTER
    >> *INSERT. If
    >> the error occurred in a trigger program, the associated text is the
    >> type of
    >> trigger program. If the error occurred in an external function, the
    >>
    >> associated text is the text of the error message returned from the
    >> external
    >> function.
    >>
    >> Does anybody has any idea why doesn't it work ?
    >>
    >> Regards,
    >> Tomasz

    >
    > If you use addpftrg then the db passes 2 parameters to your program.
    > The 1st contains the trigger data & the 2nd is the length of the 1st.
    > If you coded a CL program then you must accept exactly 2 parms. Type
    > DSPPGM progname & page down twice you will see the number of
    > parameters. Either accept dummy parameters to make up the number or
    > change to CLLE. Doing DSPPGM on CLLE shows a min & max number of
    > parameters which may be passed.
    >
    > HTH
    > Jonathan.
    >


  6. Re: trigger program error

    il 07/09/2007 12.07, Scrive tomasz 40646240:
    > Hi.
    >
    > Many thanks for help.
    > I've used SQL CREATE TRIGGER and it's working as it should work !!!
    > As usually your advice was very helpfull.
    >
    > Regards,
    > Tomasz

    Pleased to help you!
    :-))

    --
    Dr.Ugo Gagliardelli,Modena,ItalyCertifiedUindoscrasherAñe joAlcoolInside
    Spaccamaroni andate a cagare/Spammers not welcome/Spammers vão à merda
    Spamers iros a la mierda/Spamers allez vous faire foutre/Spammers loop
    schijten/Spammers macht Euch vom Acker/Spamerzy wypierdalac'

+ Reply to Thread