Enterprise Cobol obtaining calling program name

5 pts.
Tags:
COBOL
Data Area
MVS
Enterprise Cobol v3.4 on Z/OS 1.9. Batch called program. I want to parse through mvs data areas to obtain the program name that called my program(dynamically). I have viewed examples on Share website to get some system info. I need specifically the program name that called my program. Is this possible in a batch program? thanks
ASKED: February 2, 2010  8:20 PM
UPDATED: February 4, 2010  2:30 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

This can be done by calling a CL program with the Program name is input for which you want find out the Caller. Use that input name in SNDPGMMSG with TOPGMQ parameter *PRV and entry parameter (program name). Do RCVMSG with PGMQ parameter value as *PRV and entry parameter on *PGMQ the Sender parameter on RCVMSG will have the calling program name. do a RMVMSG to clear the messages sent

SNDPGMMSG MSG(‘msg’) TOPGMQ(*PRV &entparm) KEYVAR(&KEY)

RCVMSG PGMQ(*PRV &entparm) MSGQ(*PGMQ) MSGKEY(&KEY) SENDER(&SEND)

Check the value of SEND

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Meandyou
    In MVS (z/OS) COBOL, this would be quite a trick. it isn't easy even in Assembler. You will need to access the CDE chain and dig thru protected memory. This is the calling chain that you see in a dump. Or maybe it could be done by accessing the savearea of the calling program and determine which program owns that piece of storage; not sure how to code that. I know I have seen code pieces that address this, but it has been a LONG time. You might try some more mainframe centric sites like IBM's DeveloperWorks. Some people make it a practice to include the name of the caller in the parms passed to the called module. maybe like this:
       IDENTIFICATION DIVISION.
       PROGRAM-ID.   PROG001.
    
       WORKING STORAGE SECTION.
       01  PARMS-PASSED.
           05  CALLER              PIC X(8)    VALUE 'PROG001'.
           05  REAL-DATA        PIC ....
     
       PROCEDURE DIVISION.
       ...
       CALL 'PROG002' USING PARMS-PASSED.
    
    This would be a lot of work to retro-fit into an existing application system. But you might remember it for the future.
    5,220 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following