RCVMSG works as expected when this (program not found) fails
ADDPFTRG FILE(FRP003) TRGTIME(*AFTER) +
TRGEVENT(*INSERT) PGM(FRR803) +
RPLTRG(*YES) TRG(FRP003_INSERT_AFTER_TEST)
but does not work as expected when this
ADDPFTRG FILE(FRP003) TRGTIME(*AFTER) +
TRGEVENT(*INSERT) PGM(MYTESTLIB/FRR803) +
RPLTRG(*YES) TRG(FRP003_INSERT_AFTER_TEST)
fails.
I took my original program, X, cloned it, and removed the trigger program
library qualification. This gave me the desired results, CPF9811 (*DIAG)
and CPF32C6 (*EXCP).
The *only* difference is the presence of the trigger program library name.
I'm getting *DIAG message CPF9811 ("Program () in library () not found" in
the job log with both test programs but only the *LIBL code traps and
forwards it.
The failing program (X) does this
From program . . . . . . . . . : QDBTRIG2
From library . . . . . . . . : QSYS
From module . . . . . . . . : QDBTRG2AUT
From procedure . . . . . . . : QDBGEN_SEND_PGM_MSG
From statement . . . . . . . : 1617
To program . . . . . . . . . . : QDBTRIGG
To library . . . . . . . . . : QSYS
Instruction . . . . . . . . : 0069
while the good program (Y) does this
From program . . . . . . . . . : QCADRV
From library . . . . . . . . : QSYS
Instruction . . . . . . . . : 041C
To program . . . . . . . . . . : Y
To library . . . . . . . . . : MYTESTLIB
To module . . . . . . . . . : Y
To procedure . . . . . . . . : Y
To statement . . . . . . . . : 3900
I am befuddled. In program Y, I'm picking up the *DIAG message because
it's being sent to the caller; in program X, the *DIAG message is
percolating up through the ADDPFTRG command and appears in the job log but
isn't seen by the RCVMSG as configured.
The RCVMSG command looks like this:
RCVMSG MSGTYPE(*PRV) MSGKEY(&KEYVAR) RMV(*NO) KEYVAR(&KEYVAR2) +
MSG(&MSG) MSGDTA(&MSGDTA) MSGID(&MSGID) RTNTYPE(&RTNTYPE) +
MSGF(&MSGF) SNDMSGFLIB(&MSGFLIB)
I'm guessing that CPF, when encountering a *LIBL, looks for the object and
returns an error if the object can;t be found *and* before invoking the
trigger CPP. When the object is qualified, CPF appears to pass control to
the CPP and the CPP is the routine that posts the "not found" error.
Any suggestions on cleaning up the RCVMSG command will be appreciated!
Stay safe, get your COVID and flu shots, and (if you're in the U.S.) enjoy
Thanksgiving.
Thanks!
As an Amazon Associate we earn from qualifying purchases.