|
Andrew,
I figured out the names of the pgms by updating the file with DFU, sql, etc.
Then I changed the pgm to monitor for those names plus names that don't
begin with 'Q'.
At the end I pasted my modification to Denis's CL pgm.
The rpg trigger pgm calls this CL only once. But, the two api's are called
many times which slows things down considerably. In my environment it's not
perceptible by the user but if I were writing millions of records this would
suck.
Last week there was a thread on USER vs CURRENT USER. If you want to know
who updated a file via Ops Nav ISQL (for example), you can't use the PSDS
because it will contain QUSER. I haven't done anything about that yet but I
understand RTVJOBA contains the current user.
Phil
Here's how I modifed Denis's CL pgm:
PGM PARM(&PGMID)
DCL VAR(&NIVTST) TYPE(*DEC) LEN(2 0)
DCL VAR(&NIVTRV) TYPE(*DEC) LEN(2 0)
DCL VAR(&NIVBIN) TYPE(*CHAR) LEN(4)
DCL VAR(&RCVVAR) TYPE(*CHAR) LEN(512)
DCL VAR(&APIERRCDE) TYPE(*CHAR) LEN(8) +
VALUE(X'0000000000000000')
DCL VAR(&MSGKEY) TYPE(*CHAR) LEN(4)
DCL VAR(&PGMID) TYPE(*CHAR) LEN(10)
DCL VAR(&HLDCLR) TYPE(*CHAR) LEN(10)
DCL VAR(&DONE) TYPE(*CHAR) LEN(1)
/* initialization */
CHGVAR VAR(&NIVTST) VALUE(3)
CHGVAR VAR(&NIVTRV) VALUE(0)
DOUNTIL:
IF COND(&DONE *EQ '1') THEN(GOTO CMDLBL(FINISHED))
CHGVAR VAR(%BIN(&NIVBIN)) VALUE(&NIVTST)
CALL PGM(QMHSNDPM) PARM(' ' ' ' 'Dummy' +
X'00000005' '*INFO' '*' &NIVBIN &MSGKEY +
&APIERRCDE)
MONMSG MSGID(CPF0000) EXEC(DO)
/* past last call stack entry */
CHGVAR VAR(&PGMID) VALUE(UNK)
GOTO CMDLBL(FINISHED)
ENDDO
CALL PGM(QMHRCVPM) PARM(&RCVVAR X'00000200' +
'RCVM0300' '*' &NIVBIN '*ANY' &MSGKEY +
X'00000000' '*REMOVE' &APIERRCDE)
CHGVAR VAR(&PGMID) VALUE(%SST(&RCVVAR 472 10))
/* Do not want to return trigger pgm
*/
IF COND(&NIVTST *GT 3) THEN(DO)
IF COND(%SST(&PGMID 1 1) *NE 'Q') THEN(CHGVAR +
VAR(&DONE) VALUE('1'))
IF COND(%SST(&PGMID 1 5) *EQ 'QDZTD') +
THEN(CHGVAR VAR(&DONE) VALUE('1'))
IF COND(%SST(&PGMID 1 3) *EQ 'QSQ') THEN(CHGVAR +
VAR(&HLDCLR) VALUE('ISQL'))
IF COND(%SST(&PGMID 1 3) *EQ 'UNK') +
THEN(CHGVAR VAR(&DONE) VALUE('1'))
ENDDO
CHGVAR VAR(&NIVTST) VALUE(&NIVTST + 1)
GOTO CMDLBL(DOUNTIL)
FINISHED: IF COND(&PGMID *EQ 'UNK' *AND &HLDCLR *EQ +
'ISQL') THEN(CHGVAR VAR(&PGMID) +
VALUE(&HLDCLR))
IF COND(%SST(&PGMID 1 5) *EQ 'QDZTD') +
THEN(CHGVAR VAR(&PGMID) VALUE('UPDDTA'))
ENDPGM
> -----Original Message-----
> From: rpg400-l-admin@midrange.com [mailto:rpg400-l-admin@midrange.com]On
> Behalf Of Andrew Lutz
> Sent: Thursday, December 20, 2001 1:34 PM
> To: rpg400-l@midrange.com
> Subject: RE: Who envoked that trigger program?
>
>
> The trigger program may triggered by:
>
> STRSQL
> STRDFU
> DBU
> EZVIEW
> RPGLE
> SQLRPGLE
> and etc...
>
> All of the examples I have found
>
> Look for a program in the call stack that doesn't start with Q
> Look for a program in the call stack that doesn't exist in
> library that doesn't start with a Q
> Use a fixed call counter to go back in the call stack
>
> All of the above solutions above won't work if the source of the
> trigger is 'unknown'.
>
>
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.