Okay, let's run with this one.

If program A has an entry, B, and the program is compiled with NAME(ALIAS), 
when the program is linked, there will be an entry for A and an entry for B as 
an ALIAS of A.

When A is executed, a statement in the program says SET XXXX TO ENTRY B where 
XXXX is defined as PROCEDURE-POINTER.

Does a separate copy of the load module get loaded as B when this SET statement 
is executed or does the runtime simply gain access to the entry point B within 
the currently loaded version of A?

If a separate copy of the load module is loaded as B, where is the recursion?
If a separate copy of the load module is not loaded, I can see the recursion.

C-

Charles (Chuck) Hardee
Senior Systems Engineer/Database Administration
EAS Information Technology

Thermo Fisher Scientific
300 Industry Drive | Pittsburgh, PA 15275
Phone +1 (724) 517-2633 | Mobile +1 (412) 877-2809 | FAX: +1 (412) 490-9230
[email protected]  | www.thermofisher.com

WORLDWIDE CONFIDENTIALITY NOTE: Dissemination, distribution or copying of this 
e-mail or the information herein by anyone other than the intended recipient, 
or an employee or agent of a system responsible for delivering the message to 
the intended recipient, is prohibited. If you are not the intended recipient, 
please inform the sender and delete all copies.


-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf 
Of Mike Schwab
Sent: Tuesday, August 09, 2016 12:29 PM
To: [email protected]
Subject: Re: How does COBOL detect a recursive call?

http://www.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.ieab100/reus.htm
When you link edit, you indicate the re-usability of the program.
When the program runs, it reuses the same program if re-entrant.  Each
use has a different set of registers and working storage.
Serially reusable can be self modifying (storing into load module
areas), but can be reused after completing.  Needs a new copy for a
simultaneous use.
None means the program must be reloaded from disk for every use.

When you run a program, the LOAD macro examines the directory and
loads as appropriate.
http://www.longpelaexpertise.com/ezine/ReentrantBeginners.php



On Tue, Aug 9, 2016 at 9:59 AM, John McKown
<[email protected]> wrote:
> On Tue, Aug 9, 2016 at 9:40 AM, John McKown <[email protected]>
> wrote:
>
>> This is a kind of curiosity question. Unless a COBOL program is compiled
>> with the THREAD option and the RECURSIVE clause on the PROGRAM-ID, the
>> program cannot CALL itself. I have also found out that if you use an ENTRY
>> statement and the compile NAME(ALIAS), you cannot do a CALL of the alias
>> from the "main" program either. E.g. if you have a PROGRAM-ID. A. and an
>> ENTRY 'B', then you cannot CALL 'B' while running A. I am thinking this
>> must be in some way related to the fact that 'A' and 'B' share the same
>> WORKING-STORAGE area. But I was just wondering if anybody knows how this is
>> implemented. Of course, it is probably likely to change between releases,
>> so it's not something I could depend on.
>>
>> Why the interest? Because while talking with Chuck Hardee about having an
>> LE condition handler in the same source member (as an ENTRY) as the main
>> COBOL routine, we found that the run-unit will abend with a U4087-2 and
>> some messages about recursive invocation. So as a test, I compiled a sample
>> which got the U4087-2 with the THREAD option and RECURSIVE clause, and that
>> ran successfully. However the THREAD option comes with some possibley nasty
>> side restrictions. In particular, no INITIAL clause in the PROGRAM-ID
>> sentence and, worse, no use of SORT / MERGE verbs.
>>
>
> Well, here I am talking to myself again. At least I'm not, yet, into the 3
> way arguments with myself. But it turns out that I misread the manual.
> RECURSIVE is required on the PROGRAM-ID if THREAD is used, but not vice
> versa. So it appears that all I really need is the RECURSIVE clause on the
> PROGRAM-ID and not the THREAD compile option. But I'm still mildly curious
> about how COBOL detects recursion, if you know off-hand.
>
> --
> Klein bottle for rent -- inquire within.
>
> Maranatha! <><
> John McKown
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to [email protected] with the message: INFO IBM-MAIN



-- 
Mike A Schwab, Springfield IL USA
Where do Forest Rangers go to get away from it all?

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to