× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi,

Depending on the trigger event the database manager invokes either QDBPUT
(for Input) or QDBUDR (for Update, Delete, Read).
These programs call the trigger program.
You either can use the API QWVRCSTK and go back until you find either QDBPUT
or QDBUDR and simply take the call stack entry before, or you can use a
simple CL-Program with SNDPGMMSG and RCVMSG:

/*****************************************************************/
/* Object. . . . . . . . . : PRVPGM */
/* Funkcion. . . . . . . . : Retrieve Caller Programm */
/* from Call Stack */
/* Parameter . . . . . . . : CALLER 10 A */
/* CALLED 10 A */
/* Author . . . . . . . . : B.Hauser */
/*****************************************************************/
PGM PARM(&CALLER +
&CALLED)
/* ---------------------------------------------------------------*/
DCL VAR(&CALLER) TYPE(*CHAR) LEN(10)
DCL VAR(&CALLED) TYPE(*CHAR) LEN(10)

DCL VAR(&MSGKEY) TYPE(*CHAR) LEN(4)
DCL VAR(&SENDER) TYPE(*CHAR) LEN(80)
/* ---------------------------------------------------------------*/
SNDPGMMSG MSG('TEST') +
TOPGMQ(*PRV (&CALLED)) +
MSGTYPE(*RQS) +
KEYVAR(&MSGKEY)

RCVMSG PGMQ(*PRV (&CALLED)) +
MSGKEY(&MSGKEY) +
SENDER(&SENDER)

CHGVAR VAR(&CALLER) VALUE(%SST(&SENDER 56 10))
ENDE: ENDPGM

Just pass QDPUT or QDBUDR as CALLED and you'll get the program that
activated the trigger back (as CALLER).


Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"

-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im
Auftrag von Luis Rodriguez
Gesendet: Friday, August 03, 2007 21:18
An: RpgMidrange
Betreff: Getting the name of a trigger-causing program


Hi List,

Is there any that I can obtain, in a RPG Trigger processing program, the
name of the program that caused the trigger to occur in first place?

Thanks,

Luis Rodriguez


Luis Rodriguez

IBM Certified Systems Expert
eServer i5 iSeries Technical Solutions




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.