Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Stupid trigger question.

72 views
Skip to first unread message

Ralph McClusky

unread,
Mar 17, 2004, 4:28:43 AM3/17/04
to
Hi All,

I am on a v4r5 system and writing my very 1st trigger program but just
can't get the penny to drop.

Every time I use upddta to update the file I get in the upddta screen:
Message CPF502B was issued. When I check the joblog I see a
Error occurred in trigger program.
Error occurred in trigger program.
(the error occurs twice in the joblog)

The error is 'The error code is 2.' which is 2 -- *AFTER *INSERT
trigger

Basically the program just outputs to a file and that is it

Tx in advance

My file trigger is:
ADDPFTRG FILE(FTTEST/FPTESTTRG) TRGTIME(*AFTER) TRGEVENT(*INSERT)
PGM(FTTEST/TRGTSTR) ALWREPCHG(*YES)

The program is:
H D
FFPTXTOUTO E K DISK A
*
I '<DOCODE>' C C@1
I 'NET SEND RMCC70 NEW -C C@2
I 'USER IN FTTEST'
I '<DODATA>' C C@3
I 'X' C C@4
C MOVELC@1 FTLINE P
C WRITEFPTXTR
C MOVELC@2 FTLINE P
C WRITEFPTXTR
C MOVELC@3 FTLINE P
C WRITEFPTXTR
C MOVELC@4 FTLINE P
C WRITEFPTXTR
*
C SETON LR

jb

unread,
Mar 17, 2004, 5:43:18 AM3/17/04
to
"Ralph McClusky" <rmc...@hotmail.com> wrote in message
news:9f42b1cb.04031...@posting.google.com...

It looks like you are programming in RPG400. Since you dont seem to have a
*ENTRY PLIST in your program there will be no parameters in the program. Do
a DSPPGM & I think you will see the min & max program parms are zero .So
when the DB calls your trigger it gets a problem with the number of
parameters passed to the program.
If you dont need the parameter data then just add a parm list with the right
number of parms of any sort & ignore them in the program.

--
Jonathan.


Steve Landess

unread,
Mar 17, 2004, 9:24:32 AM3/17/04
to

Ralph - as jb indicated, your program isn't accepting the
two parms that are necessary in a trigger-handling program

I can send you a working example of RPG400 code if you like,
just send me a private reply to this message.

Steve Landess
Austin, Texas
(512) 423-0935


Ralph McClusky

unread,
Mar 19, 2004, 2:43:44 AM3/19/04
to
Tx muchly for the replies.

What I was trying to say but was only implying was that I didn't want
the file data (or whatever) but just was trying to create an event
trigger. ie no trigger parameters were wanted.

Once I read your replies I figured I HAD to specify the parameters and
tried the below, which works fine:
=========================================================
C *ENTRY PLIST
C PARM PARM1 1
C PARM PARM2 1
=========================================================
there are no other references and the thing works, even when I added a
CL as the triggger reference.
=========================================================
PGM (&PARM1 &PARM2)

DCL &PARM1 *CHAR 1
DCL &PARM2 *CHAR 1

CLRPFM FPTXTOUT
CALL TRGTSTR (&PARM1 &PARM2)
SBMJOB CMD(CALL PGM(SXCUTC) PARM('-----'))

ENDPGM: ENDPGM
========================================================
Of course I would take a punt that I don't need the RPG code PARMS
now.

Altho. I am surprised that the program doesn't fall over with a
message about the wrong paramater length etc

rMmC70

ps: tx for the offer of the code but I got there ;)

jb

unread,
Mar 19, 2004, 4:45:17 AM3/19/04
to
"Ralph McClusky" <rmc...@hotmail.com> wrote in message
news:9f42b1cb.04031...@posting.google.com...

If you coded in RPG IV or CLLE & possibly any ILE language then the program
would not need a *ENTRY PLIST or equivalent. Try it & take a look at the
output from DSPPPGM. I seem to get this for all the ILE progs I look at :
Number of parameters . . . . . . . . . . . . . : 0 255

The parameter type is not checked in this case though it is if you start
using modules. The parameters you have here are simply pointers to something
like a void* in C, you have to make sure you are right when you 'join'
programs together in this way.

--
Jonathan Bailey.


Barbara Morris

unread,
Mar 19, 2004, 2:55:50 PM3/19/04
to
jb wrote:
>
> The parameter type is not checked in this case though it is if you start
> using modules. The parameters you have here are simply pointers to something
> like a void* in C, you have to make sure you are right when you 'join'
> programs together in this way.
>

The parameter type isn't checked at runtime even if you use modules
(prototyped calls). It's a compile-time check, and if you code the
prototype wrong you can still have problems with mismatches.

0 new messages