Re: Determining program name/number of paramaters from called COBOL program

2020-09-23 Thread Windt, W.K.F. van der (Fred)
The call sequence is described in the LE Programming Reference:



CEETBCK

Call this CWI interface as follows:

L R15,CEECAALEOV-CEECAA(,R12)   Address of CAA in R12

L R15,304(,R15)

BALR  R14,R15


Get Outlook for iOS<https://aka.ms/o0ukef>

From: IBM Mainframe Discussion List  on behalf of 
Chris Cantrell 
Sent: Wednesday, September 23, 2020 8:31:59 PM
To: IBM-MAIN@LISTSERV.UA.EDU 
Subject: Re: Determining program name/number of paramaters from called COBOL 
program

Thanks Fred!

I was trying this and I can't seem to find CEETBCK in any of our libraries. I 
looked at all of the .SECC* libraries and no luck. Do you happen to know what 
library it should be in?

Thanks again!

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

-
ATTENTION:
The information in this e-mail is confidential and only meant for the intended 
recipient. If you are not the intended recipient, don't use or disclose it in 
any way. Please let the sender know and delete the message immediately.
-

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


Re: Determining program name/number of paramaters from called COBOL program

2020-09-23 Thread Lizette Koehler
https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.1.0/com.ibm.zos.v2r1.ceev100/ceetbck.htm

Lizette

-Original Message-
From: IBM Mainframe Discussion List  On Behalf Of 
Chris Cantrell
Sent: Wednesday, September 23, 2020 11:32 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Determining program name/number of paramaters from called COBOL 
program

Thanks Fred!

I was trying this and I can't seem to find CEETBCK in any of our libraries. I 
looked at all of the .SECC* libraries and no luck. Do you happen to know what 
library it should be in?

Thanks again!

--
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


Re: Determining program name/number of paramaters from called COBOL program

2020-09-23 Thread Chris Cantrell
Thanks Fred!

I was trying this and I can't seem to find CEETBCK in any of our libraries. I 
looked at all of the .SECC* libraries and no luck. Do you happen to know what 
library it should be in?

Thanks again!

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


Re: Determining program name/number of paramaters from called COBOL program

2020-09-23 Thread Windt, W.K.F. van der (Fred)
CEETBCK can help you to achive this. It is described in the LE Vendor 
Interfaces manual. But you need to write a little assembler program to use 
CEETBCK.

Groetz,

Fred!

-Original Message-
From: IBM Mainframe Discussion List  On Behalf Of 
Chris Cantrell
Sent: dinsdag 22 september 2020 21:24
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Determining program name/number of paramaters from called COBOL program

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
-
ATTENTION:
The information in this e-mail is confidential and only meant for the intended 
recipient. If you are not the intended recipient, don't use or disclose it in 
any way. Please let the sender know and delete the message immediately.
-

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


Re: Determining program name/number of paramaters from called COBOL program

2020-09-23 Thread Chris Cantrell
LE

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


Re: Determining program name/number of paramaters from called COBOL program

2020-09-22 Thread Tom Brennan
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


Re: Determining program name/number of paramaters from called COBOL program

2020-09-22 Thread Seymour J Metz
Wrong. That's the job step; the caller may be many levels down.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3



From: IBM Mainframe Discussion List  on behalf of Joe 
Monk 
Sent: Tuesday, September 22, 2020 6:34 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Determining program name/number of paramaters from called COBOL 
program

Well, he can always look to the JSCB to determine the caller, right?

Joe

On Tue, Sep 22, 2020 at 4:19 PM Seymour J Metz  wrote:

> The parm list won't tell him who's calling him. I wouldn't be surprised if
> the special cases cover his requirements, but until he spells them out, ...
>
>
> --
> Shmuel (Seymour J.) Metz
> http://mason.gmu.edu/~smetz3
>
>
> 
> From: IBM Mainframe Discussion List  on behalf
> of Joe Monk 
> Sent: Tuesday, September 22, 2020 4:40 PM
> To: IBM-MAIN@LISTSERV.UA.EDU
> Subject: Re: Determining program name/number of paramaters from called
> COBOL program
>
> yeah ... but R1 should point to the parm list ... and he would calling this
> assembler stub 1st thing so ...
>
> Joe
>
> On Tue, Sep 22, 2020 at 3:23 PM Seymour J Metz  wrote:
>
> > If the data are not in the called programs then chasing the save areas
> > won't find the data. The basic form of a SAVE is just an STM (24 bit) or
> > similar instructions.
> >
> >
> > --
> > Shmuel (Seymour J.) Metz
> > http://mason.gmu.edu/~smetz3
> >
> >
> > 
> > From: IBM Mainframe Discussion List  on behalf
> > of Joe Monk 
> > Sent: Tuesday, September 22, 2020 4:16 PM
> > To: IBM-MAIN@LISTSERV.UA.EDU
> > Subject: Re: Determining program name/number of paramaters from called
> > COBOL program
> >
> > he could work his way back thru the saveareas, no?
> >
> > Joe
> >
> > On Tue, Sep 22, 2020 at 3:05 PM Seymour J Metz  wrote:
> >
> > > Standard linkage conventions don't require branching around an
> eyecatcher
> > > or that they eyecatcher be in a standardized format or even include the
> > > module name. So the question is what special cases does the OP need to
> > > handle.
> > >
> > >
> > > --
> > > Shmuel (Seymour J.) Metz
> > > http://mason.gmu.edu/~smetz3
> > >
> > >
> > > 
> > > From: IBM Mainframe Discussion List  on
> behalf
> > > of Joe Monk 
> > > Sent: Tuesday, September 22, 2020 4:00 PM
> > > To: IBM-MAIN@LISTSERV.UA.EDU
> > > Subject: Re: Determining program name/number of paramaters from called
> > > COBOL program
> > >
> > > If it's using standard OS linkage, he could use an assembler routine to
> > do
> > > a traceback and get some of the items.
> > >
> > > The problem will come in if passed by value instead of by reference...
> > >
> > > Joe
> > >
> > > On Tue, Sep 22, 2020 at 2:58 PM Seymour J Metz  wrote:
> > >
> > > > I doubt that it's possible in general, certain special cases are
> > > possible.
> > > >
> > > >
> > > > --
> > > > Shmuel (Seymour J.) Metz
> > > > http://mason.gmu.edu/~smetz3
> > > >
> > > >
> > > > 
> > > > From: IBM Mainframe Discussion List  on
> > behalf
> > > > of Chris Cantrell 
> > > > Sent: Tuesday, September 22, 2020 3:24 PM
> > > > To: IBM-MAIN@LISTSERV.UA.EDU
> > > > Subject: Determining program name/number of paramaters from called
> > COBOL
> > > > program
> > > >
> > > > 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 

Re: Determining program name/number of paramaters from called COBOL program

2020-09-22 Thread Seymour J Metz
Yes, but we don't know what he's using. I hope it's not 5734-CB1.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3



From: IBM Mainframe Discussion List  on behalf of Joe 
Monk 
Sent: Tuesday, September 22, 2020 6:49 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Determining program name/number of paramaters from called COBOL 
program

Well, here is the answer to at least part of the puzzle, if not all...

"You can find the name of the calling programs from a COBOL V5 or V6 program
at run time by using the LE service CEETBCK. For more information, see
the z/OS®
Language Environment® Vendor Interfaces."

https://www-01.ibm.com/servers/resourcelink/svc00100.nsf/pages/zOSV2R3SA380688/$file/ceev100_v2r3.pdf

Joe


On Tue, Sep 22, 2020 at 5:42 PM Paul Gilmartin <
000433f07816-dmarc-requ...@listserv.ua.edu> wrote:

> On Tue, 22 Sep 2020 21:51:34 +, Farley, Peter x23353 wrote:
>
> >Current Enterprise COBOL compilers (and back as far as I know, even COBOL
> F-level from MVT) always mark the last parameter address in the address
> list with the bit 0 turned on, though I have not researched what current
> ones do if the last parameter is "BY VALUE".
> >
> >Again for current Enterprise COBOL versions, the LE Vendor Interfaces
> manual available in KC has the PPA1 format and in general how to locate it.
> >
> The answer depends on agreement between the designers of the calling
> and called programs.  Lacking such agreement there's no general
> solution.
>
> C programs called by a POSIX shell can rely on argc, but only because
> that's
> specified in the Standard.
>
> -- gil
>
> --
> 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


Re: Determining program name/number of paramaters from called COBOL program

2020-09-22 Thread Seymour J Metz
You can use CSVQUERY to get the name of the caller's load module, but that 
still won't get you the name of the caller.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3



From: IBM Mainframe Discussion List  on behalf of 
Brian Chapman 
Sent: Tuesday, September 22, 2020 8:02 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Determining program name/number of paramaters from called COBOL 
program

Correction:  you can chain through the resister save area and use the *caller's
entry point* (not CEECAA)to chain to the caller's PPA and retrieve the
program name.



Thank you,

Brian Chapman


On Tue, Sep 22, 2020 at 7:39 PM Brian Chapman  wrote:

> If the called program is assembler and the caller is COBOL (linked with
> LE), then you can chain through the resister save area and use the CEECAA
> to chain to the caller's PPA and retrieve the program name. This method
> really only works for called assembler programs; don't bother with COBOL.
>
> The number of passed parameters is the easy part. Just use the register
> save area to read the addresses in register 1 looking for the high order
> bit.
>
> On Tue, Sep 22, 2020, 6:50 PM Joe Monk  wrote:
>
>> Well, here is the answer to at least part of the puzzle, if not all...
>>
>> "You can find the name of the calling programs from a COBOL V5 or V6
>> program
>> at run time by using the LE service CEETBCK. For more information, see
>> the z/OS®
>> Language Environment® Vendor Interfaces."
>>
>>
>> https://www-01.ibm.com/servers/resourcelink/svc00100.nsf/pages/zOSV2R3SA380688/$file/ceev100_v2r3.pdf
>>
>> Joe
>>
>>
>> On Tue, Sep 22, 2020 at 5:42 PM Paul Gilmartin <
>> 000433f07816-dmarc-requ...@listserv.ua.edu> wrote:
>>
>> > On Tue, 22 Sep 2020 21:51:34 +, Farley, Peter x23353 wrote:
>> >
>> > >Current Enterprise COBOL compilers (and back as far as I know, even
>> COBOL
>> > F-level from MVT) always mark the last parameter address in the address
>> > list with the bit 0 turned on, though I have not researched what current
>> > ones do if the last parameter is "BY VALUE".
>> > >
>> > >Again for current Enterprise COBOL versions, the LE Vendor Interfaces
>> > manual available in KC has the PPA1 format and in general how to locate
>> it.
>> > >
>> > The answer depends on agreement between the designers of the calling
>> > and called programs.  Lacking such agreement there's no general
>> > solution.
>> >
>> > C programs called by a POSIX shell can rely on argc, but only because
>> > that's
>> > specified in the Standard.
>> >
>> > -- gil
>> >
>> > --
>> > 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

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


Re: Determining program name/number of paramaters from called COBOL program

2020-09-22 Thread Farley, Peter x23353
Which can get very tricky indeed when the CALL is from an input or output exit 
routine of a COBOL internal SORT.  Trying to find your way back through the 
SORT interface routines can be frustrating at best, and impossible at worst.

Peter

-Original Message-
From: IBM Mainframe Discussion List  On Behalf Of 
Brian Chapman
Sent: Tuesday, September 22, 2020 8:02 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Determining program name/number of paramaters from called COBOL 
program

Correction:  you can chain through the resister save area and use the *caller's 
entry point* (not CEECAA)to chain to the caller's PPA and retrieve the program 
name.

Thank you,

Brian Chapman


On Tue, Sep 22, 2020 at 7:39 PM Brian Chapman  wrote:

> If the called program is assembler and the caller is COBOL (linked 
> with LE), then you can chain through the resister save area and use 
> the CEECAA to chain to the caller's PPA and retrieve the program name. 
> This method really only works for called assembler programs; don't bother 
> with COBOL.
>
> The number of passed parameters is the easy part. Just use the 
> register save area to read the addresses in register 1 looking for the 
> high order bit.
>
> On Tue, Sep 22, 2020, 6:50 PM Joe Monk  wrote:
>
>> Well, here is the answer to at least part of the puzzle, if not all...
>>
>> "You can find the name of the calling programs from a COBOL V5 or V6 
>> program at run time by using the LE service CEETBCK. For more 
>> information, see the z/OS® Language Environment® Vendor Interfaces."
>>
>>
>> https://urldefense.com/v3/__https://www-01.ibm.com/servers/resourceli
>> nk/svc00100.nsf/pages/zOSV2R3SA380688/$file/ceev100_v2r3.pdf__;!!Ebr-
>> cpPeAnfNniQ8HSAI-g_K5b7VKg!axDL42ZaIQJjblemDbSHZnQhdTAajb-KDr_hnzIti1
>> zjkD_ysD8R-DiKvbel6an7sJvSHA$
>>
>> Joe
>>
>>
>> On Tue, Sep 22, 2020 at 5:42 PM Paul Gilmartin < 
>> 000433f07816-dmarc-requ...@listserv.ua.edu> wrote:
>>
>> > On Tue, 22 Sep 2020 21:51:34 +, Farley, Peter x23353 wrote:
>> >
>> > >Current Enterprise COBOL compilers (and back as far as I know, 
>> > >even
>> COBOL
>> > F-level from MVT) always mark the last parameter address in the 
>> > address list with the bit 0 turned on, though I have not researched 
>> > what current ones do if the last parameter is "BY VALUE".
>> > >
>> > >Again for current Enterprise COBOL versions, the LE Vendor 
>> > >Interfaces
>> > manual available in KC has the PPA1 format and in general how to 
>> > locate
>> it.
>> > >
>> > The answer depends on agreement between the designers of the 
>> > calling and called programs.  Lacking such agreement there's no 
>> > general solution.
>> >
>> > C programs called by a POSIX shell can rely on argc, but only 
>> > because that's specified in the Standard.
>> >
-- 

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


Re: Determining program name/number of paramaters from called COBOL program

2020-09-22 Thread Brian Chapman
Correction:  you can chain through the resister save area and use the *caller's
entry point* (not CEECAA)to chain to the caller's PPA and retrieve the
program name.



Thank you,

Brian Chapman


On Tue, Sep 22, 2020 at 7:39 PM Brian Chapman  wrote:

> If the called program is assembler and the caller is COBOL (linked with
> LE), then you can chain through the resister save area and use the CEECAA
> to chain to the caller's PPA and retrieve the program name. This method
> really only works for called assembler programs; don't bother with COBOL.
>
> The number of passed parameters is the easy part. Just use the register
> save area to read the addresses in register 1 looking for the high order
> bit.
>
> On Tue, Sep 22, 2020, 6:50 PM Joe Monk  wrote:
>
>> Well, here is the answer to at least part of the puzzle, if not all...
>>
>> "You can find the name of the calling programs from a COBOL V5 or V6
>> program
>> at run time by using the LE service CEETBCK. For more information, see
>> the z/OS®
>> Language Environment® Vendor Interfaces."
>>
>>
>> https://www-01.ibm.com/servers/resourcelink/svc00100.nsf/pages/zOSV2R3SA380688/$file/ceev100_v2r3.pdf
>>
>> Joe
>>
>>
>> On Tue, Sep 22, 2020 at 5:42 PM Paul Gilmartin <
>> 000433f07816-dmarc-requ...@listserv.ua.edu> wrote:
>>
>> > On Tue, 22 Sep 2020 21:51:34 +, Farley, Peter x23353 wrote:
>> >
>> > >Current Enterprise COBOL compilers (and back as far as I know, even
>> COBOL
>> > F-level from MVT) always mark the last parameter address in the address
>> > list with the bit 0 turned on, though I have not researched what current
>> > ones do if the last parameter is "BY VALUE".
>> > >
>> > >Again for current Enterprise COBOL versions, the LE Vendor Interfaces
>> > manual available in KC has the PPA1 format and in general how to locate
>> it.
>> > >
>> > The answer depends on agreement between the designers of the calling
>> > and called programs.  Lacking such agreement there's no general
>> > solution.
>> >
>> > C programs called by a POSIX shell can rely on argc, but only because
>> > that's
>> > specified in the Standard.
>> >
>> > -- gil
>> >
>> > --
>> > 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


Re: Determining program name/number of paramaters from called COBOL program

2020-09-22 Thread Brian Chapman
If the called program is assembler and the caller is COBOL (linked with
LE), then you can chain through the resister save area and use the CEECAA
to chain to the caller's PPA and retrieve the program name. This method
really only works for called assembler programs; don't bother with COBOL.

The number of passed parameters is the easy part. Just use the register
save area to read the addresses in register 1 looking for the high order
bit.

On Tue, Sep 22, 2020, 6:50 PM Joe Monk  wrote:

> Well, here is the answer to at least part of the puzzle, if not all...
>
> "You can find the name of the calling programs from a COBOL V5 or V6
> program
> at run time by using the LE service CEETBCK. For more information, see
> the z/OS®
> Language Environment® Vendor Interfaces."
>
>
> https://www-01.ibm.com/servers/resourcelink/svc00100.nsf/pages/zOSV2R3SA380688/$file/ceev100_v2r3.pdf
>
> Joe
>
>
> On Tue, Sep 22, 2020 at 5:42 PM Paul Gilmartin <
> 000433f07816-dmarc-requ...@listserv.ua.edu> wrote:
>
> > On Tue, 22 Sep 2020 21:51:34 +, Farley, Peter x23353 wrote:
> >
> > >Current Enterprise COBOL compilers (and back as far as I know, even
> COBOL
> > F-level from MVT) always mark the last parameter address in the address
> > list with the bit 0 turned on, though I have not researched what current
> > ones do if the last parameter is "BY VALUE".
> > >
> > >Again for current Enterprise COBOL versions, the LE Vendor Interfaces
> > manual available in KC has the PPA1 format and in general how to locate
> it.
> > >
> > The answer depends on agreement between the designers of the calling
> > and called programs.  Lacking such agreement there's no general
> > solution.
> >
> > C programs called by a POSIX shell can rely on argc, but only because
> > that's
> > specified in the Standard.
> >
> > -- gil
> >
> > --
> > 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


Re: Determining program name/number of paramaters from called COBOL program

2020-09-22 Thread Joe Monk
Well, here is the answer to at least part of the puzzle, if not all...

"You can find the name of the calling programs from a COBOL V5 or V6 program
at run time by using the LE service CEETBCK. For more information, see
the z/OS®
Language Environment® Vendor Interfaces."

https://www-01.ibm.com/servers/resourcelink/svc00100.nsf/pages/zOSV2R3SA380688/$file/ceev100_v2r3.pdf

Joe


On Tue, Sep 22, 2020 at 5:42 PM Paul Gilmartin <
000433f07816-dmarc-requ...@listserv.ua.edu> wrote:

> On Tue, 22 Sep 2020 21:51:34 +, Farley, Peter x23353 wrote:
>
> >Current Enterprise COBOL compilers (and back as far as I know, even COBOL
> F-level from MVT) always mark the last parameter address in the address
> list with the bit 0 turned on, though I have not researched what current
> ones do if the last parameter is "BY VALUE".
> >
> >Again for current Enterprise COBOL versions, the LE Vendor Interfaces
> manual available in KC has the PPA1 format and in general how to locate it.
> >
> The answer depends on agreement between the designers of the calling
> and called programs.  Lacking such agreement there's no general
> solution.
>
> C programs called by a POSIX shell can rely on argc, but only because
> that's
> specified in the Standard.
>
> -- gil
>
> --
> 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


Re: Determining program name/number of paramaters from called COBOL program

2020-09-22 Thread Paul Gilmartin
On Tue, 22 Sep 2020 21:51:34 +, Farley, Peter x23353 wrote:

>Current Enterprise COBOL compilers (and back as far as I know, even COBOL 
>F-level from MVT) always mark the last parameter address in the address list 
>with the bit 0 turned on, though I have not researched what current ones do if 
>the last parameter is "BY VALUE".
>
>Again for current Enterprise COBOL versions, the LE Vendor Interfaces manual 
>available in KC has the PPA1 format and in general how to locate it.
> 
The answer depends on agreement between the designers of the calling
and called programs.  Lacking such agreement there's no general
solution.

C programs called by a POSIX shell can rely on argc, but only because that's
specified in the Standard.

-- gil

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


Re: Determining program name/number of paramaters from called COBOL program

2020-09-22 Thread Farley, Peter x23353
"As soon as you allow by-value parms, you can completely forget the leftmost 
bit technique to mark the last parameter (address)."

Not necessarily.  One technique I have seen used elsewhere Is to add a 'dummy" 
last parameter of X'8000' to mark the end of the list, but I do not know if 
COBOL and/or LE use this technique.

Obviously both caller and called have to respect that convention.

COBOL could also copy the BY VALUE parameter to a compiler-allocated temp 
storage area and pass the address of that area instead of the source area.  For 
a large table or record area that could get quite expensive in CPU time if the 
call is done frequently, but it is at least transparent to the called program 
who does not have to know whether the value was passed by value or by 
reference.  Again, I don’t know if any version of COBOL that supports BY VALUE 
paremeters uses that technique.

Peter

-Original Message-
From: IBM Mainframe Discussion List  On Behalf Of 
Bernd Oppolzer
Sent: Tuesday, September 22, 2020 6:21 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Determining program name/number of paramaters from called COBOL 
program

Am 22.09.2020 um 23:51 schrieb Farley, Peter x23353:
> Current Enterprise COBOL compilers (and back as far as I know, even COBOL 
> F-level from MVT) always mark the last parameter address in the address list 
> with the bit 0 turned on, though I have not researched what current ones do 
> if the last parameter is "BY VALUE".

Thanks :-)

if you have by-value parameters (not addresses), then you're stuck; by-value 
integers, for example - s9(9) comp in COBOL speech - can be positive or 
negative and have the leftmost bit set off or on, so examining the "addresses" 
(which are in fact not addresses in this case) leads nowhere.

Same goes for PL/1 BYVALUE parameters.

As soon as you allow by-value parms, you can completely forget the leftmost bit 
technique to mark the last parameter (address).

That's why C, for example, does not use nor support the VL bit, although 
variable numbers of parameters are supported (#include ); instead the 
called function must be able to determine the total number of parms from one of 
the leading parms, like in the printf() function, for example.

Kind regards

Bernd

>
> Again for current Enterprise COBOL versions, the LE Vendor Interfaces manual 
> available in KC has the PPA1 format and in general how to locate it.
>
> 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


Re: Determining program name/number of paramaters from called COBOL program

2020-09-22 Thread Charles Mills
If COBOL is like C (and I thought it was) then the words of the vector pointed 
to by R1 on a CALL are all addresses, not values, and so the high-order bit is 
available as a VL end-of-list flag. Does "BY VALUE" in COBOL mean the value is 
in the parm vector? (What about 64-bit values, or long character strings?) Or 
does it mean -- as with C -- that the value passed is a copy of the calling 
program's variable? IOW, the calling linkage is the same -- BY VALUE just means 
that if the called program changes the value the caller never sees the change.

It's interesting -- there is no doc -- at least in the V6.3 P/G -- for "calling 
an assembly language program." I had to go back to COBOL V2 to find any 
reference to calling assembly language programs. The doc there says that 
assembler calling COBOL "should" set the VL bit but does not discuss going the 
other direction. For something that shops do all the time the lack of doc is 
pretty amazing.

I stand by my original reply:
- I strongly suspect you can find the R1 from the entry into the called program 
by chaining back some specific number (perhaps 1) of calls in the save area 
chain, from an assembler routine written for this purpose.
- I strongly suspect COBOL uses the VL bit, so that assembler routine can count 
the passed parameters.
- You can find the EXEC PGM= program name from the JSCB. (And others have 
pointed out you can find the last loaded program name from the CDE chain.)

Charles


-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of Farley, Peter x23353
Sent: Tuesday, September 22, 2020 2:52 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Determining program name/number of paramaters from called COBOL 
program

Current Enterprise COBOL compilers (and back as far as I know, even COBOL 
F-level from MVT) always mark the last parameter address in the address list 
with the bit 0 turned on, though I have not researched what current ones do if 
the last parameter is "BY VALUE".

Again for current Enterprise COBOL versions, the LE Vendor Interfaces manual 
available in KC has the PPA1 format and in general how to locate it.

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


Re: Determining program name/number of paramaters from called COBOL program

2020-09-22 Thread Joe Monk
Well, he can always look to the JSCB to determine the caller, right?

Joe

On Tue, Sep 22, 2020 at 4:19 PM Seymour J Metz  wrote:

> The parm list won't tell him who's calling him. I wouldn't be surprised if
> the special cases cover his requirements, but until he spells them out, ...
>
>
> --
> Shmuel (Seymour J.) Metz
> http://mason.gmu.edu/~smetz3
>
>
> 
> From: IBM Mainframe Discussion List  on behalf
> of Joe Monk 
> Sent: Tuesday, September 22, 2020 4:40 PM
> To: IBM-MAIN@LISTSERV.UA.EDU
> Subject: Re: Determining program name/number of paramaters from called
> COBOL program
>
> yeah ... but R1 should point to the parm list ... and he would calling this
> assembler stub 1st thing so ...
>
> Joe
>
> On Tue, Sep 22, 2020 at 3:23 PM Seymour J Metz  wrote:
>
> > If the data are not in the called programs then chasing the save areas
> > won't find the data. The basic form of a SAVE is just an STM (24 bit) or
> > similar instructions.
> >
> >
> > --
> > Shmuel (Seymour J.) Metz
> > http://mason.gmu.edu/~smetz3
> >
> >
> > 
> > From: IBM Mainframe Discussion List  on behalf
> > of Joe Monk 
> > Sent: Tuesday, September 22, 2020 4:16 PM
> > To: IBM-MAIN@LISTSERV.UA.EDU
> > Subject: Re: Determining program name/number of paramaters from called
> > COBOL program
> >
> > he could work his way back thru the saveareas, no?
> >
> > Joe
> >
> > On Tue, Sep 22, 2020 at 3:05 PM Seymour J Metz  wrote:
> >
> > > Standard linkage conventions don't require branching around an
> eyecatcher
> > > or that they eyecatcher be in a standardized format or even include the
> > > module name. So the question is what special cases does the OP need to
> > > handle.
> > >
> > >
> > > --
> > > Shmuel (Seymour J.) Metz
> > > http://mason.gmu.edu/~smetz3
> > >
> > >
> > > 
> > > From: IBM Mainframe Discussion List  on
> behalf
> > > of Joe Monk 
> > > Sent: Tuesday, September 22, 2020 4:00 PM
> > > To: IBM-MAIN@LISTSERV.UA.EDU
> > > Subject: Re: Determining program name/number of paramaters from called
> > > COBOL program
> > >
> > > If it's using standard OS linkage, he could use an assembler routine to
> > do
> > > a traceback and get some of the items.
> > >
> > > The problem will come in if passed by value instead of by reference...
> > >
> > > Joe
> > >
> > > On Tue, Sep 22, 2020 at 2:58 PM Seymour J Metz  wrote:
> > >
> > > > I doubt that it's possible in general, certain special cases are
> > > possible.
> > > >
> > > >
> > > > --
> > > > Shmuel (Seymour J.) Metz
> > > > http://mason.gmu.edu/~smetz3
> > > >
> > > >
> > > > 
> > > > From: IBM Mainframe Discussion List  on
> > behalf
> > > > of Chris Cantrell 
> > > > Sent: Tuesday, September 22, 2020 3:24 PM
> > > > To: IBM-MAIN@LISTSERV.UA.EDU
> > > > Subject: Determining program name/number of paramaters from called
> > COBOL
> > > > program
> > > >
> > > > 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

Re: Determining program name/number of paramaters from called COBOL program

2020-09-22 Thread Bernd Oppolzer

Am 22.09.2020 um 23:51 schrieb Farley, Peter x23353:

Current Enterprise COBOL compilers (and back as far as I know, even COBOL F-level from 
MVT) always mark the last parameter address in the address list with the bit 0 turned on, 
though I have not researched what current ones do if the last parameter is "BY 
VALUE".


Thanks :-)

if you have by-value parameters (not addresses), then you're stuck;
by-value integers, for example - s9(9) comp in COBOL speech -
can be positive or negative and have the leftmost bit set off or on,
so examining the "addresses" (which are in fact not addresses in this case)
leads nowhere.

Same goes for PL/1 BYVALUE parameters.

As soon as you allow by-value parms, you can completely forget the
leftmost bit technique to mark the last parameter (address).

That's why C, for example, does not use nor support the VL bit,
although variable numbers of parameters are supported (#include 
);

instead the called function must be able to determine the total number
of parms from one of the leading parms, like in the printf() function, 
for example.


Kind regards

Bernd



Again for current Enterprise COBOL versions, the LE Vendor Interfaces manual 
available in KC has the PPA1 format and in general how to locate it.

Peter


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


Re: Determining program name/number of paramaters from called COBOL program

2020-09-22 Thread Farley, Peter x23353
Current Enterprise COBOL compilers (and back as far as I know, even COBOL 
F-level from MVT) always mark the last parameter address in the address list 
with the bit 0 turned on, though I have not researched what current ones do if 
the last parameter is "BY VALUE".

Again for current Enterprise COBOL versions, the LE Vendor Interfaces manual 
available in KC has the PPA1 format and in general how to locate it.

Peter

-Original Message-
From: IBM Mainframe Discussion List  On Behalf Of 
Bernd Oppolzer
Sent: Tuesday, September 22, 2020 4:53 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Determining program name/number of paramaters from called COBOL 
program

EXTERNAL EMAIL

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

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


Re: Determining program name/number of paramaters from called COBOL program

2020-09-22 Thread Seymour J Metz
Chasing the RB chain will identify LINK invocations, but not CALL invocation. 
With luck, everybody usees recognizable eyecatchers in their SAVE macros; if 
not, all bets are off.

Can we safely assume that all of the routines are LE enabled?






--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3



From: IBM Mainframe Discussion List  on behalf of 
Mike Hochee 
Sent: Tuesday, September 22, 2020 4:37 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Determining program name/number of paramaters from called COBOL 
program

If you can call a small assembler subroutine from the current COBOL pgm being 
executed (may be possible to do this in COBOL as well), use of the following 
fields should help get you current program name, callers name..., callers name, 
etc..  As mentioned, LE may make a difference, not sure. Anyway...

Curr TCB addr (PSATOLD), to curr active RB (TCBRBP), to curr CDE (RBCDE), to 
curr pgm name (CDNAME)   (you are at the end of the chain when RBCDE1=0, and 
you may have to clear the high order byte to get a valid compare)

For the name of previous caller(s)...
Curr TCB addr (PSATOLD), to curr active RB (TCBRBP), to next RB in chain 
(RBLINK), to curr CDE (RBCDE), to pgm name (CDENAME)

HTH,
Mike
-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of Chris Cantrell
Sent: Tuesday, September 22, 2020 3:24 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Determining program name/number of paramaters from called COBOL program

Caution! This message was sent from outside your organization.

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


Re: Determining program name/number of paramaters from called COBOL program

2020-09-22 Thread Seymour J Metz
The parm list won't tell him who's calling him. I wouldn't be surprised if the 
special cases cover his requirements, but until he spells them out, ...


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3



From: IBM Mainframe Discussion List  on behalf of Joe 
Monk 
Sent: Tuesday, September 22, 2020 4:40 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Determining program name/number of paramaters from called COBOL 
program

yeah ... but R1 should point to the parm list ... and he would calling this
assembler stub 1st thing so ...

Joe

On Tue, Sep 22, 2020 at 3:23 PM Seymour J Metz  wrote:

> If the data are not in the called programs then chasing the save areas
> won't find the data. The basic form of a SAVE is just an STM (24 bit) or
> similar instructions.
>
>
> --
> Shmuel (Seymour J.) Metz
> http://mason.gmu.edu/~smetz3
>
>
> 
> From: IBM Mainframe Discussion List  on behalf
> of Joe Monk 
> Sent: Tuesday, September 22, 2020 4:16 PM
> To: IBM-MAIN@LISTSERV.UA.EDU
> Subject: Re: Determining program name/number of paramaters from called
> COBOL program
>
> he could work his way back thru the saveareas, no?
>
> Joe
>
> On Tue, Sep 22, 2020 at 3:05 PM Seymour J Metz  wrote:
>
> > Standard linkage conventions don't require branching around an eyecatcher
> > or that they eyecatcher be in a standardized format or even include the
> > module name. So the question is what special cases does the OP need to
> > handle.
> >
> >
> > --
> > Shmuel (Seymour J.) Metz
> > http://mason.gmu.edu/~smetz3
> >
> >
> > 
> > From: IBM Mainframe Discussion List  on behalf
> > of Joe Monk 
> > Sent: Tuesday, September 22, 2020 4:00 PM
> > To: IBM-MAIN@LISTSERV.UA.EDU
> > Subject: Re: Determining program name/number of paramaters from called
> > COBOL program
> >
> > If it's using standard OS linkage, he could use an assembler routine to
> do
> > a traceback and get some of the items.
> >
> > The problem will come in if passed by value instead of by reference...
> >
> > Joe
> >
> > On Tue, Sep 22, 2020 at 2:58 PM Seymour J Metz  wrote:
> >
> > > I doubt that it's possible in general, certain special cases are
> > possible.
> > >
> > >
> > > --
> > > Shmuel (Seymour J.) Metz
> > > http://mason.gmu.edu/~smetz3
> > >
> > >
> > > 
> > > From: IBM Mainframe Discussion List  on
> behalf
> > > of Chris Cantrell 
> > > Sent: Tuesday, September 22, 2020 3:24 PM
> > > To: IBM-MAIN@LISTSERV.UA.EDU
> > > Subject: Determining program name/number of paramaters from called
> COBOL
> > > program
> > >
> > > 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
> >
> > --
> > For IBM-MAIN subs

Re: Determining program name/number of paramaters from called COBOL program

2020-09-22 Thread Bernd Oppolzer
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


Re: Determining program name/number of paramaters from called COBOL program

2020-09-22 Thread Joe Monk
yeah ... but R1 should point to the parm list ... and he would calling this
assembler stub 1st thing so ...

Joe

On Tue, Sep 22, 2020 at 3:23 PM Seymour J Metz  wrote:

> If the data are not in the called programs then chasing the save areas
> won't find the data. The basic form of a SAVE is just an STM (24 bit) or
> similar instructions.
>
>
> --
> Shmuel (Seymour J.) Metz
> http://mason.gmu.edu/~smetz3
>
>
> 
> From: IBM Mainframe Discussion List  on behalf
> of Joe Monk 
> Sent: Tuesday, September 22, 2020 4:16 PM
> To: IBM-MAIN@LISTSERV.UA.EDU
> Subject: Re: Determining program name/number of paramaters from called
> COBOL program
>
> he could work his way back thru the saveareas, no?
>
> Joe
>
> On Tue, Sep 22, 2020 at 3:05 PM Seymour J Metz  wrote:
>
> > Standard linkage conventions don't require branching around an eyecatcher
> > or that they eyecatcher be in a standardized format or even include the
> > module name. So the question is what special cases does the OP need to
> > handle.
> >
> >
> > --
> > Shmuel (Seymour J.) Metz
> > http://mason.gmu.edu/~smetz3
> >
> >
> > 
> > From: IBM Mainframe Discussion List  on behalf
> > of Joe Monk 
> > Sent: Tuesday, September 22, 2020 4:00 PM
> > To: IBM-MAIN@LISTSERV.UA.EDU
> > Subject: Re: Determining program name/number of paramaters from called
> > COBOL program
> >
> > If it's using standard OS linkage, he could use an assembler routine to
> do
> > a traceback and get some of the items.
> >
> > The problem will come in if passed by value instead of by reference...
> >
> > Joe
> >
> > On Tue, Sep 22, 2020 at 2:58 PM Seymour J Metz  wrote:
> >
> > > I doubt that it's possible in general, certain special cases are
> > possible.
> > >
> > >
> > > --
> > > Shmuel (Seymour J.) Metz
> > > http://mason.gmu.edu/~smetz3
> > >
> > >
> > > 
> > > From: IBM Mainframe Discussion List  on
> behalf
> > > of Chris Cantrell 
> > > Sent: Tuesday, September 22, 2020 3:24 PM
> > > To: IBM-MAIN@LISTSERV.UA.EDU
> > > Subject: Determining program name/number of paramaters from called
> COBOL
> > > program
> > >
> > > 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
> >
> > --
> > 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
>

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


Re: Determining program name/number of paramaters from called COBOL program

2020-09-22 Thread Mike Hochee
If you can call a small assembler subroutine from the current COBOL pgm being 
executed (may be possible to do this in COBOL as well), use of the following 
fields should help get you current program name, callers name..., callers name, 
etc..  As mentioned, LE may make a difference, not sure. Anyway... 

Curr TCB addr (PSATOLD), to curr active RB (TCBRBP), to curr CDE (RBCDE), to 
curr pgm name (CDNAME)   (you are at the end of the chain when RBCDE1=0, and 
you may have to clear the high order byte to get a valid compare) 
  
For the name of previous caller(s)... 
Curr TCB addr (PSATOLD), to curr active RB (TCBRBP), to next RB in chain 
(RBLINK), to curr CDE (RBCDE), to pgm name (CDENAME)   

HTH, 
Mike 
-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of Chris Cantrell
Sent: Tuesday, September 22, 2020 3:24 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Determining program name/number of paramaters from called COBOL program

Caution! This message was sent from outside your organization.

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


Re: Determining program name/number of paramaters from called COBOL program

2020-09-22 Thread Seymour J Metz
If the data are not in the called programs then chasing the save areas won't 
find the data. The basic form of a SAVE is just an STM (24 bit) or similar 
instructions.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3



From: IBM Mainframe Discussion List  on behalf of Joe 
Monk 
Sent: Tuesday, September 22, 2020 4:16 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Determining program name/number of paramaters from called COBOL 
program

he could work his way back thru the saveareas, no?

Joe

On Tue, Sep 22, 2020 at 3:05 PM Seymour J Metz  wrote:

> Standard linkage conventions don't require branching around an eyecatcher
> or that they eyecatcher be in a standardized format or even include the
> module name. So the question is what special cases does the OP need to
> handle.
>
>
> --
> Shmuel (Seymour J.) Metz
> http://mason.gmu.edu/~smetz3
>
>
> 
> From: IBM Mainframe Discussion List  on behalf
> of Joe Monk 
> Sent: Tuesday, September 22, 2020 4:00 PM
> To: IBM-MAIN@LISTSERV.UA.EDU
> Subject: Re: Determining program name/number of paramaters from called
> COBOL program
>
> If it's using standard OS linkage, he could use an assembler routine to do
> a traceback and get some of the items.
>
> The problem will come in if passed by value instead of by reference...
>
> Joe
>
> On Tue, Sep 22, 2020 at 2:58 PM Seymour J Metz  wrote:
>
> > I doubt that it's possible in general, certain special cases are
> possible.
> >
> >
> > --
> > Shmuel (Seymour J.) Metz
> > http://mason.gmu.edu/~smetz3
> >
> >
> > 
> > From: IBM Mainframe Discussion List  on behalf
> > of Chris Cantrell 
> > Sent: Tuesday, September 22, 2020 3:24 PM
> > To: IBM-MAIN@LISTSERV.UA.EDU
> > Subject: Determining program name/number of paramaters from called COBOL
> > program
> >
> > 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
>
> --
> 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


Re: Determining program name/number of paramaters from called COBOL program

2020-09-22 Thread Joe Monk
he could work his way back thru the saveareas, no?

Joe

On Tue, Sep 22, 2020 at 3:05 PM Seymour J Metz  wrote:

> Standard linkage conventions don't require branching around an eyecatcher
> or that they eyecatcher be in a standardized format or even include the
> module name. So the question is what special cases does the OP need to
> handle.
>
>
> --
> Shmuel (Seymour J.) Metz
> http://mason.gmu.edu/~smetz3
>
>
> 
> From: IBM Mainframe Discussion List  on behalf
> of Joe Monk 
> Sent: Tuesday, September 22, 2020 4:00 PM
> To: IBM-MAIN@LISTSERV.UA.EDU
> Subject: Re: Determining program name/number of paramaters from called
> COBOL program
>
> If it's using standard OS linkage, he could use an assembler routine to do
> a traceback and get some of the items.
>
> The problem will come in if passed by value instead of by reference...
>
> Joe
>
> On Tue, Sep 22, 2020 at 2:58 PM Seymour J Metz  wrote:
>
> > I doubt that it's possible in general, certain special cases are
> possible.
> >
> >
> > --
> > Shmuel (Seymour J.) Metz
> > http://mason.gmu.edu/~smetz3
> >
> >
> > 
> > From: IBM Mainframe Discussion List  on behalf
> > of Chris Cantrell 
> > Sent: Tuesday, September 22, 2020 3:24 PM
> > To: IBM-MAIN@LISTSERV.UA.EDU
> > Subject: Determining program name/number of paramaters from called COBOL
> > program
> >
> > 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
>
> --
> 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


Re: Determining program name/number of paramaters from called COBOL program

2020-09-22 Thread Seymour J Metz
Standard linkage conventions don't require branching around an eyecatcher or 
that they eyecatcher be in a standardized format or even include the module 
name. So the question is what special cases does the OP need to handle.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3



From: IBM Mainframe Discussion List  on behalf of Joe 
Monk 
Sent: Tuesday, September 22, 2020 4:00 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Determining program name/number of paramaters from called COBOL 
program

If it's using standard OS linkage, he could use an assembler routine to do
a traceback and get some of the items.

The problem will come in if passed by value instead of by reference...

Joe

On Tue, Sep 22, 2020 at 2:58 PM Seymour J Metz  wrote:

> I doubt that it's possible in general, certain special cases are possible.
>
>
> --
> Shmuel (Seymour J.) Metz
> http://mason.gmu.edu/~smetz3
>
>
> 
> From: IBM Mainframe Discussion List  on behalf
> of Chris Cantrell 
> Sent: Tuesday, September 22, 2020 3:24 PM
> To: IBM-MAIN@LISTSERV.UA.EDU
> Subject: Determining program name/number of paramaters from called COBOL
> program
>
> 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

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


Re: Determining program name/number of paramaters from called COBOL program

2020-09-22 Thread Joe Monk
If it's using standard OS linkage, he could use an assembler routine to do
a traceback and get some of the items.

The problem will come in if passed by value instead of by reference...

Joe

On Tue, Sep 22, 2020 at 2:58 PM Seymour J Metz  wrote:

> I doubt that it's possible in general, certain special cases are possible.
>
>
> --
> Shmuel (Seymour J.) Metz
> http://mason.gmu.edu/~smetz3
>
>
> 
> From: IBM Mainframe Discussion List  on behalf
> of Chris Cantrell 
> Sent: Tuesday, September 22, 2020 3:24 PM
> To: IBM-MAIN@LISTSERV.UA.EDU
> Subject: Determining program name/number of paramaters from called COBOL
> program
>
> 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


Re: Determining program name/number of paramaters from called COBOL program

2020-09-22 Thread Seymour J Metz
I doubt that it's possible in general, certain special cases are possible.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3



From: IBM Mainframe Discussion List  on behalf of 
Chris Cantrell 
Sent: Tuesday, September 22, 2020 3:24 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Determining program name/number of paramaters from called COBOL program

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


Re: Determining program name/number of paramaters from called COBOL program

2020-09-22 Thread Joe Monk
Language Environment or non-LE?

Joe

On Tue, Sep 22, 2020 at 2:24 PM Chris Cantrell <
chris.cantr...@palmettogba.com> wrote:

> 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


Re: Determining program name/number of paramaters from called COBOL program

2020-09-22 Thread Charles Mills
I think the official, supported answer would be that the calling program should 
pass that information.

With regard to number of parms -- COBOL should have a special register for 
that! -- I suspect you could write an assembler program that you called from 
the called COBOL program, worked its way back through the save area chain, 
found the parms that its caller was called with, and counted them. You might 
have to experiment to determine whether the call was one save area back, two, 
or perhaps more. Hopefully it would be consistent, but see paragraph one above.

The name of the calling program is a little more difficult. What is its "name"? 
The PROGRAM-ID? The PGM= name? What about subprograms and dynamically loaded 
callers?

You can get the PGM= name from the JSCB (again, from an assembler subroutine).

PSATOLD->TCB
TCBJSCB->JSCB
JSCBPGMN is the PGM= name

Charles


-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of Chris Cantrell
Sent: Tuesday, September 22, 2020 12:24 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Determining program name/number of paramaters from called COBOL program

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


Determining program name/number of paramaters from called COBOL program

2020-09-22 Thread 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