This may be a bit outside the box (or someone may have mentioned it
already), but in the past when I wanted to know if someone was using a
particular program, I'd rename that member to something else and create
my own front end under the original name, which would spit out a WTO or
similar and then LINK to the original.
On 9/22/2020 1:53 PM, Bernd Oppolzer wrote:
I've done similar things for other languages (C, PL/1, ASSEMBLER), but
not for COBOL.
Some remarks:
- the desired name of the caller needs to be specified more precisely.
By examining the save area chain, it is possible to retrieve the entry
point of the calling procedure
(Reg 15 in the save area), and, given that it is a COBOL program of a
certain compiler release,
it will be possible to retrieve the name of that program (IIRC, there is
a control block PPA1,
which is pointed to by an address nearby the entry point ... dont recall
the details;
should work for most newer LE compilers). Other possibities: the name of
the load module
which contains the entry point address could be examined (using the CDE
chain).
This can be done regardless of the compiler release and even the
language of the caller, BTW.
The results of both approaches may differ.
- in a similar way, it is possible to get the addresses passed as
parameters to the calling function
(using Reg 1), that is, the addresses that point to the different parts
of the LINKAGE SECTION.
But it is IMO not possible in the general case to count the number of
addresses, unless
the COBOL compiler marks the last address with the leftmost bit on
(which I don't know).
Maybe someone more familiar with COBOL internals could comment on this.
In general, the number of parameters is fixed and is a matter of
negotiation between
caller and called program. And in this case, there is no need to mark
the last address.
And then, as a consequence, no way for the caller to determine the right
number of
addresses at run time.
HTH, kind regards
Bernd
Am 22.09.2020 um 21:24 schrieb Chris Cantrell:
Hello,
I am hoping someone out there can help me with this 'opportunity'.
In a Z/OS enterprise COBOL environment, I want to be able to retrieve
the calling program name and the number of parms passed to the called
program from the called program. In other words, program A is executed
in my batch job and it calls program B passing 5 parms in the using
statement. I want program B to be able to retrieve the program name
for program A as well as the number of parms that were passed to it.
I think if I could get to the program stack I could probably figure it
out from there.
Any assistance that any of you could provide would be greatly
appreciated.
Thanks!
----------------------------------------------------------------------
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