|
This can be done trought programming. I am including a program that we use here for that. (I apologize for the fact that all comments are in french, we are a french canadian company). The first parameter is how up in the call stack you want to go (1 in your case) The second parameter is the name of the program in the position of the call stack you requested. By the way, this program works in both ILE and OPM mode /* *%%% CRTBNDCL */ /* *%%% PGM(%LIBO/%OBJ) */ /* *%%% SRCFILE(%LIBS/%FIC) */ /* *%%% SRCMBR(%MBR) */ /* *%%% DFTACTGRP(*NO) */ /* *%%% ACTGRP(*CALLER) */ /* *%%% DBGVIEW(*LIST) */ /* *%%%& */ /*===================================================================*/ /* AUTEUR : Denis robitaille */ /* DATE : 1999/6/4 */ /* COMMANDE : ------ */ /* */ /* Extrait le nom d'un des programmes appelant de niveau N */ /* Ex: pgma -> pgmb -> cePgm */ /* N2 N1 */ /* */ /*===================================================================*/ PGM PARM(&NIVRECA &PGMID) DCL VAR(&NIVRECA) TYPE(*CHAR) LEN(2) DCL VAR(&NIVREC) TYPE(*DEC) LEN(2 0) DCL VAR(&NIVTST) TYPE(*DEC) LEN(2 0) DCL VAR(&NIVTRV) TYPE(*DEC) LEN(2 0) DCL VAR(&NIVBIN) TYPE(*CHAR) LEN(4) DCL VAR(&RCVVAR) TYPE(*CHAR) LEN(512) DCL VAR(&APIERRCDE) TYPE(*CHAR) LEN(8) + VALUE(X'0000000000000000') DCL VAR(&MSGKEY) TYPE(*CHAR) LEN(4) DCL VAR(&PGMID) TYPE(*CHAR) LEN(10) DCL VAR(&PGMIDPR) TYPE(*CHAR) LEN(10) /* initialisation */ CHGVAR VAR(&NIVREC) VALUE(&NIVRECA) CHGVAR VAR(&NIVTST) VALUE(2) CHGVAR VAR(&NIVTRV) VALUE(0) DOUNTIL: IF COND(&NIVREC *EQ &NIVTRV) THEN(GOTO + CMDLBL(FINDO)) CHGVAR VAR(%BIN(&NIVBIN)) VALUE(&NIVTST) CALL PGM(QMHSNDPM) PARM(' ' ' ' 'Dummy' + X'00000005' '*INFO' '*' &NIVBIN &MSGKEY + &APIERRCDE) MONMSG MSGID(CPF0000) EXEC(DO) /* on a depasser le "call stack" */ CHGVAR VAR(&PGMID) VALUE(*ERR) GOTO CMDLBL(FINDO) ENDDO CALL PGM(QMHRCVPM) PARM(&RCVVAR X'00000200' + 'RCVM0300' '*' &NIVBIN '*ANY' &MSGKEY + X'00000000' '*REMOVE' &APIERRCDE) CHGVAR VAR(&PGMID) VALUE(%SST(&RCVVAR 472 10)) /* on ignore le CLPEP qui existe en mode ILE */ IF COND(&PGMID *NE &PGMIDPR) THEN(DO) CHGVAR VAR(&NIVTRV) VALUE(&NIVTRV + 1) CHGVAR VAR(&PGMIDPR) VALUE(&PGMID) ENDDO CHGVAR VAR(&NIVTST) VALUE(&NIVTST + 1) GOTO CMDLBL(DOUNTIL) FINDO: ENDPGM Denis Robitaille Directeur services techniques Cascades Inc 819 363 5187 fax 819 363 5177 >>> "Shepherd Chacko (RBIN/COP)" <Shepherd.Chacko@in.bosch.com> 03/23/00 >10:01am >>> 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-2025 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.