Bob,
Since John is working with a stripped down copy of my program I resurrected the
copy of the program with my debugging displays in it where I had already coded
the displays for the two addresses you asked about.
Displaying the main entry point address, that is, the name of the program as
coded in the PROGRAM-ID clause, the address displayed is 11E00A10.
Displaying the program name as coded on the ENTRY statement, the address
displayed is 11E02C78.
The difference between these two address is x'2268'.
According to the linkage map, the offset to the ENTRY statement name is x'2268'.
So, it appears that the runtime is getting the address of the code that is
within the initially loaded module, not a fresh copy.
So, looking at the link output, it was reported that the module was linked as:
RENT YES
REUS YES
So, it is definitely a recursive call.
Chuck
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 Bill Woodger
Sent: Tuesday, August 09, 2016 6:52 PM
To: [email protected]
Subject: How does COBOL detect a recursive call?
OK, it is the RENT or REUS (either will do) on the link-edit/bindering.
Without RENT/REUS you get a new executable for free. With RENT/REUS you get to
"share" the original program, but it is necessarily a "recursive" use, so you
get the "IGZ0064S A recursive call to active program..." message. Which is why
IBM say you must CANCEL before the CALL to the ENTRY, which you can't do if the
CALL is to an ENTRY in the same program. PROGRAM-ID ... IS RECURSIVE "gets
around" the IGZ0064S, so there won't be a second condition, which causes
another, and another. So LE will be happy.
So, you've discovered a way to nearly get a CALL to an ENTRY point with an
ALIAS to work like it used to :-)
However, there is overhead. The recursive CALL will share WORKING-STORAGE, but
pretty much everything else will be initialised on each CALL, and then all
thrown away on each GOBACK (since it is not actually recursing). For a one-shot
use, this will not matter.
Safe to use? Well, understanding how it works/doesn't work wasn't easy for me
:-)
Here's an example of the generated code from the COBOL compiler showing the
recursion checking:
ICM 2,15,336(9) IPCB=1+16
L 11,40(0,12) PBL=1
BC 8,210(0,11) GN=6(0002E6)
L 3,92(0,9) TGTFIXD+92
L 15,244(0,3) V(IGZCMSG )
LA 1,206(0,10) PGMLIT AT +202
BASR 14,15
PGMLIT AT +202 is X'40', which is the 64 for the IGZ message.
There is similar code generated for an ENTRY.
And here's the code from the GOBACK clearing up to say things will be OK for
another CALL:
L 3,336(0,9) IPCB=1+16
S 3,0(0,12) SYSLIT AT +0
ST 3,336(0,9) IPCB=1+16
----------------------------------------------------------------------
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