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

Reply via email to