× 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.



Give this a try (from http://www.as400pro.com/ ):

What program triggered the trigger? / Call stack
Here it goes, This is a low tech solution and can be made into Procedures
using Message API's if you want to make it real fancy. But as is, it will
also work for the average Joe/Jane programmer too.

For trigger's
In your *INZSR subroutine repeatedly call a CLP to retrieve the program name
of the caller. You can "walk up the Stack" past the programs(OS/400's that
begin with "Q") to the program you're looking for.

Just call the below program repeatedly(in a loop in your *INZSR), First time
pass your trigger program name(the program who's *inzsr you are currently in
that is) as the &CALLED, and who ever called your trigger will be returned
in the &CALLER variable. This will undoubtedly be a "Q" OS/400 program. Call
the CLP again this time pass what was returned the first time to find out
who called him, and so on. up the stack till *EXT.

Stop at the first program name(&CALLER) doesn't begin with a "Q". That's the
application program that kicked off the trigger.




PGM    &CALLER &CALLED

DCL   &CALLER  *CHAR  10
DCL   &CALLED  *CHAR  10
DCL   &M1KEY   *CHAR   4
DCL   &M1MDTA  *CHAR  80

SNDPGMMSG  MSG('TEST')  TOPGMQ(*PRV &CALLED) MSGTYPE(*RQS) KEYVAR(&M1KEY)

RCVMSG   PGMQ(*PRV &CALLED)  MSGKEY(&M1KEY)  SENDER(&M1MDTA)

CHGVAR   &CALLER    %SST(&M1MDTA  56 10)

ENDPGM


So, Just call it with a program name(&CALLED) and it will tell you who
called that program(&CALLER), next time pass it what was returned the
previous time to find out who called him, and so on up the stack. Look at
the name returned (&CALLER) if the first position of the name is a "Q" it's
an OS/400 program. (Unless you are, hmm shall we we say, Dumb enough to
start your program names with the letter Q ?)

================================

Mike Silvers
AS/400 Senior Programmer/Analyst
AS/400 IBM Certified RPG IV Developer
AS/400 IBM Certified Expert
Hainey Business Systems
8 E. Canal St
Dover, PA 17315
Branch Office:  (410) 397-8739
Phone:  (800) 932-3380
Fax:  (717) 292-9474
Web: http://www.hbs-inc.com
________________________________
Providing E-Commerce, EDI, AS/400
Development and related services
nationwide.
================================
----- Original Message -----
From: Phil Groschwitz <sublime78ska@yahoo.com>
To: <rpg400-l@midrange.com>
Sent: Thursday, December 06, 2001 11:08 AM
Subject: trigger buffer


> Is there any way to get the pgm name that did the
> update/insert/delete from the trigger buffer?  Or
> anywhere else besides the journal?
>
> My need is to block all pgms except the maintenance
> pgm from updating the file.
>
> Thanks,
>
> Phil
>
> __________________________________________________
> Do You Yahoo!?
> Send your FREE holiday greetings online!
> http://greetings.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.
>
>




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.