Thanks Alan, this was exactly what I needed and its implemented already.

 
Thanks for sharing


AlanShore@xxxxxxxx 7/20/2006 4:00:59 PM >>>


I use the following in my program
D CallingPgmNam   s                   like(Pgmnam)
D CallingPgmLib   s                   like(Pgmlib)

D GetCaller       PR                  Extpgm('QWVRCSTK')
D                             2000
D                               10I 0
D                                8    CONST
D                               56
D                                8    CONST
D                               15

D Var             DS          2000
D  BytAvl                       10I 0
D  BytRtn                       10I 0
D  Entries                      10I 0
D  Offset                       10I 0
D  EntryCount                   10I 0
D VarLen          S             10I 0 Inz(%size(Var))
D ApiErr          S             15

D JobIdInf        DS
D  JIDQName                     26    Inz('*')
D  JIDIntID                     16
D  JIDRes3                       2    Inz(*loval)
D  JIDThreadInd                 10I 0 Inz(1)
D  JIDThread                     8    Inz(*loval)

D Entry           DS           256
D  EntryLen                     10I 0
D  PgmNam                       10    Overlay(Entry:25)
D  PgmLib                       10    Overlay(Entry:35)

c                   eval      CallingPgmNam = *blanks
c                   eval      CallingPgmLib = *blanks
C                   CallP     GetCaller(Var:VarLen:'CSTK0100':JobIdInf
C                             :'JIDF0100':ApiErr)
C                   Do        EntryCount
C                   Eval      Entry = %subst(Var:Offset + 1)
c                   if        CallingPgmNam = *blanks and
c                             CallingPgmLib = *blanks
c                   if        PgmNam = psdsPgmName and
c                             PgmLib = psdsPgmLib
C                   Else
c                   eval      CallingPgmNam = Pgmnam
c                   eval      CallingPgmLib = Pgmlib
C                   Endif
C                   Endif
C                   Eval      Offset = Offset + EntryLen
C                   Enddo


I hope I got everything for you



Alan Shore

NBTY, Inc
(631) 244-2000 ext. 5019
AShore@xxxxxxxx
*


                                                                      

             "Mike Cunningham"                                        

             <MCUNNING@xxxxxxx                                        

             >                                                         
To
             Sent by:                  <rpg400-l@xxxxxxxxxxxx>        

             rpg400-l-bounces@                                         
cc
             midrange.com                                             

                                                                  
Subject
                                       Find the calling program       

             07/20/2006 03:25                                         

             PM                                                       

                                                                      

                                                                      

             Please respond to                                        

              RPG programming                                         

              on the AS400 /                                          

                  iSeries                                             

             <rpg400-l@midrang                                        

                  e.com>                                              

                                                                      

                                                                      





Is there any way for an RPG to determine what program called it?  I am
writing a service program that writes records to a database and one of
the fields I want to store is the name of the program that asked the
service program to create the record. So PGMA calls PGMB that calls
SERVICEPGM I want SERVICEPGM to write a database record with PGMB in
the
tracking field. I have done this many years ago but at that time I
passed a parameter to know who was requesting the service but then all
the code was mine and I trust my code :) This time a lot of people
will
be using the service program and I would prefer not to let them pass
me
anything they want.

Mike Cunningham
Pennsylvania College of Technology
www.pct.edu
mcunning@xxxxxxx
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
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 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.