You use the LE service CEETBCK. This is the traceback utility and can be
used to walk the call chain backwards from Enteprise COBOL.

Joe



On Tue, May 2, 2023 at 12:08 PM Schmitt, Michael <michael.schm...@dxc.com>
wrote:

> I wrote an assembler subprogram that gets the name of the caller of the
> caller, i.e. if A > B > asm, it returns A. Or any number of levels up that
> you want. It works for static and dynamic calls, for both Language
> Environment compatible and non-LE programs.*
>
> The logic to get the program name is non-trivial. For example, in an LE
> compatible program it depends on if the Program Prolog Area is in FASTLINK
> format or not.
>
> I don't think this is possible to do in straight COBOL, because how would
> you get access to the registers for the save area chain? But maybe there's
> an LE service that could help.
>
>
> Let me know if you're interested in the assembler program.
>
>
> * assuming the program follows standard conventions for the program id
> signature string.
>
> -----Original Message-----
> From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> On Behalf
> Of Farley, Peter
> Sent: Tuesday, May 2, 2023 11:23 AM
> To: IBM-MAIN@LISTSERV.UA.EDU
> Subject: COBOL question: How to dynamically get the name of the routine
> that called you
>
> This is an Enterprise COBOL V5/6 question.  No earlier compiler versions
> are involved.
>
> Is it possible for a called COBOL program to dynamically determine the
> name of the calling COBOL program (i.e., the PROGRAM-ID value)?  I have
> been reading the LE Vendor Interfaces manual but I have yet to figure out
> now to use any of the documented services or control blocks to get the name
> of the caller.
>
> I need this for determining from where a high-usage subroutine is being
> called unnecessarily in a large main program (many called modules with
> multiple levels of CALL, but no recursion).  The subroutine unfortunately
> is NOT passed the name of the caller in the LINKAGE parameters (that would
> have been too easy . . . ).
>
> Any RTFM pointers or process to follow to get the caller's name would be
> appreciated.  I am willing to set up an assembler stub routine to capture
> the data if it cannot be done directly from the COBOL called subroutine.
>
> Peter
> --
>
>
> This message and any attachments are intended only for the use of the
> addressee and may contain information that is privileged and confidential.
> If the reader of the message is not the intended recipient or an authorized
> representative of the intended recipient, you are hereby notified that any
> dissemination of this communication is strictly prohibited. If you have
> received this communication in error, please notify us immediately by
> e-mail and delete the message and any attachments from your system.
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to