Stephen,
this procedure will give you the name of the calling program:
P*--------------------------------------------------
P* Procedure name: WhoCalledMe
P* Purpose: Caller ophalen
P* Returns: Programma naam van de caller
P*--------------------------------------------------
P WhoCalledMe B Export
D WhoCalledMe PI 10A
// Type definition for the RCVM0200 format
d RCVM0200 DS 120
d Program 111 120
// System API Error code
d vApiErrDs ds
d vbytpv 10i 0 inz(%len(vApiErrDs)) bytes provided
d vbytav 10i 0 inz(0) bytes returned
d vmsgid 7a error msgid
d vresvd 1a reserved
d vrpldta 128a replacement data
// Send Program Message
d SndMsg PR ExtPgm('QMHSNDPM')
d 7 const Message ID
d 20 const Message File
d 32767 const Text
d 10i 0 const Length
d 10 const Type
d 10 const Queue
d 10i 0 const Stack Entry
d 4 const Key
db like(vApiErrDS)
// Receive Program Message
d RcvMsg PR ExtPgm('QMHRCVPM')
d 120 Text
d 10i 0 const Length
d 8 const Format
d 10 const Stack Entry
d 10i 0 const Counter
d 10 const Message Type
d 4 const Key
d 10i 0 const Wait time
d 10 const Action
db like(vApiErrDS)
/FREE
vbytpv = 16;
Reset vApiErrDS;
SndMsg(*blanks:
*blanks:
'Who are you?':
12:
'*INFO':
'*':
5:
*blanks:
vApiErrDS);
If vbytav <> *zeros;
Return *blanks;
Else;
Clear rcvm0200;
RcvMsg(rcvm0200:
%len(rcvm0200):
'RCVM0200':
'*':
5:
'*INFO':
*blanks:
0:
'*REMOVE':
vApiErrDS);
If vbytav <> *zeros;
Return *blanks;
Else;
Return program;
EndIf;
EndIf;
/END-FREE
P WhoCalledMe E
HTH,
Peter Colpaert
Software Engineer, Consumer Luminaires
Industrieterrein Satenrozen 11, 2550 Kontich, Belgium
Tel. +32/ 3 450 74 09, Fax +32/ 3 450 74 33, Internal 1317
peter.colpaert@xxxxxxxxxxx, www.philips.com
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-
bounces@xxxxxxxxxxxx] On Behalf Of Brown, Stephen GRNRC
Sent: woensdag 1 oktober 2008 14:20
To: RPG programming on the AS400 / iSeries
Subject: RE: Best way to determine which program is causing
executionoftrigger program.
Sorry should have been more descriptive in my initial email. I have
considered this but I do have other situations where I need to
differentiate between which interactive calling program (And batch for
that matter)is causing trigger and also I thought it maybe handy for
other application.
I already have the call to QUSRJOBI (JOBI0400) in the Trigger program
but I really would like to determine the calling program if possible.
Thanks
The information contained in this message may be confidential and legally protected under applicable law. The message is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified that any use, forwarding, dissemination, or reproduction of this message is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original message.
As an Amazon Associate we earn from qualifying purchases.