|
If you think this something you may can use in other processes as well then you may want to try this. I've copied a subprocedure from one of the tips & techniques forums that returns the calling program name. If you are not using modules and subprocedures then you could possible modify the accompanying subprocedure making it a callable program. In part A is the eval statement that executes the subprocedure CALLRETURN and part B is the subprocedure code. You may want to also note that the RETURN statement besides returning the calling program has additional information such as program type, module name, procedure name which you may not want or need. Maybe this will give you some ideas. A) Line in the called program: c eval callingpgm = CALLRETURN B) SubProcedure to return calling program value: * =============================================================== * * Return Name of Calling Program * * =============================================================== * * =============================================================== * H NOMAIN D CALLRETURN pr 277a P CALLRETURN B EXPORT D PI 277A D sysSndPgmM PR EXTPGM('QMHSNDPM') D Msgid 7A CONST D Msgf 20A CONST D Msgdta 32767A CONST OPTIONS(*VARSIZE) D MsgdtaLen 10I 0 CONST D Msgtype 10A CONST D CallStk 4096A CONST OPTIONS(*VARSIZE) D CallStkOff 10I 0 CONST D Msgkey 4A D ErrorDS 32767A OPTIONS(*VARSIZE) D CallStkLen 10I 0 CONST OPTIONS(*NOPASS) D CallStkQlr 20A CONST OPTIONS(*NOPASS) D WaitTime 10I 0 CONST OPTIONS(*NOPASS) D CallStkTyp 10A CONST OPTIONS(*NOPASS) D CCSID 10I 0 CONST OPTIONS(*NOPASS) D sysRcvPgmM PR EXTPGM('QMHRCVPM') D RtnData 32767A OPTIONS(*VARSIZE) D RtnDataLen 10I 0 CONST D RtnDataFmt 8A CONST D CallStk 4096A CONST OPTIONS(*VARSIZE) D CallStkOff 10I 0 CONST D MsgType 10A CONST D Msgkey 4A CONST D WaitTime 10I 0 CONST D Action 10A CONST D ErrorDS 32767A OPTIONS(*VARSIZE) D CallStkLen 10I 0 CONST OPTIONS(*NOPASS) D CallStkQlr 20A CONST OPTIONS(*NOPASS) D CallStkTyp 10A CONST OPTIONS(*NOPASS) D CCSID 10I 0 CONST OPTIONS(*NOPASS) D MsgKey S 4A D ApiErrorDS DS D 10I 0 INZ(0) D RCVM0300 DS D 113A D rcvSndrInf 630A D rcvPgmType 1A OVERLAY(rcvSndrInf: 41) D rcvPgmName 10A OVERLAY(rcvSndrInf:355) D rcvModName 10A OVERLAY(rcvSndrInf:365) D rcvPrcName 256A OVERLAY(rcvSndrInf:375) C CALLP sysSndPgmM( *BLANK C : *BLANK C : '?' C : 1 C : '*INFO' C : '*CTLBDY ' C : 2 C : MsgKey C : ApiErrorDS ) C C CALLP sysRcvPgmM( RCVM0300 C : %SIZE(RCVM0300) C : 'RCVM0300' C : '* ' C : *ZERO C : '*INFO' C : MsgKey C : *ZERO C : '*REMOVE' C : ApiErrorDS ) C C RETURN rcvPgmName C + rcvPgmType C + rcvModName C + rcvPrcName P CALLRETURN E -----Original Message----- From: Shepherd Chacko (RBIN/COP) [mailto:RPG400-L@midrange.com] Sent: Thursday, March 23, 2000 10:02 AM To: Shepherd.Chacko@in.bosch.com; RPG400-L@midrange.com Subject: Checking Calling Program!!!! Hi All, In one of our application, we have an RPG Program say PGMR which is called by a CL Program say PGMCL. If i want to ensure that PGMR is called by PGMCL alone and not directly from command line or from any other program, how will i check this in the called Program ie PGMR.. Thanx in advance Shepherd P Chacko Robert Bosch, India. +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +--- +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
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.