|
Peter, I have search from documenation QWRCSTK and wasn't able to find any. Could you please provide a URL. Thanks Michael Smith -----Original Message----- From: rpg400-l-admin@midrange.com [mailto:rpg400-l-admin@midrange.com]On Behalf Of Peter Connell Sent: December 23, 2001 07:18 PM To: 'rpg400-l@midrange.com' Subject: New stuff on Who envoked that trigger program? Regarding the current user : If you are not aware, the program SDS in RPGLE has been extended to contain the current user (the one currently swapped to) in columns 358 to 367. If not swapped then it's value will be the same as the job user name in columns 254 to 263. The IBM online doc shows this but the version of Infoseeker on your AS400 may not have been refreshed to indicate the extension. This makes it now an obvious choice to using the QUSRJOBI API. However, you would probably want to use the API if your program did not set on LR and the profile was swapped between calls. Regarding who invoked the trigger : If you are not aware, V5R1 now provides a cool API named QWRCSTK that will return the entire invocation stack for a thread in a predefined data structure. This would also now be the obvious choice since it's a one hit process. However, you would not be able to use it if the program was to be installed on a release prior to V5R1. Cheers, Peter -----Original Message----- From: Phil [mailto:sublime78ska@yahoo.com] Sent: Friday, December 21, 2001 2:24 PM To: rpg400-l@midrange.com Subject: RE: Who envoked that trigger program? 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 _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l or email: RPG400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. This communication is confidential and may be legally privileged. If it is not addressed to you, you are on notice of its status. Please immediately contact us at our cost and destroy it. Please do not use, disclose, copy, distribute or retain any of it without our authority - to do so could be a breach of confidence. Thank you for your co-operation. Please contact us on (09) 356 5800 if you need assistance. _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l or email: RPG400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 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.