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
Software/Hardware used:
ASKED:
February 2, 2010 8:20 PM
UPDATED:
February 4, 2010 2:30 PM
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.