× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On 2011/2/1 4:58 AM, David FOXWELL wrote:

So recursive program calls are not allowed, as the message I got told
me. If I'd used MAIN, I'd have gotten away with it as I would have
been making a recursive call to the linear-main procedure which is
not the same. Wish I had the time to test it. I find that a very
round about way of saying it.


If you'd use MAIN, then you do make a recursive program call when you call using the main-procedure prototype.

The prototype looks like this:

D mypgm pr extpgm('MYPGM')

If you code
callp mypgm
it calls program *LIBL/MYPGM. It doesn't make a bound call to the actual main procedure.

You would be able to tell the difference if it was a *NEW program. If it did call the main procedure directly, both calls would be in the same activation group. But since it calls the program, you would get a different *NEW activation group.

For the program at the end of this message, I set a breakpoint in the main procedure, and on the second time it gets hit, I look at the program stack (I merged two different views of the program stack here). You can see that the second call is in a different *NEW activation group (actgrp numbers 51 and 52), and that it got to the main procedure via the PEP which indicates that it really was a program call.

---Activation Group--- Control
Program Procedure Name Number Boundary

NEWPGM BMORRIS _QRNP_PEP_NEWPGM *NEW 0000000000000051 Yes
NEWPGM BMORRIS NEWPGM *NEW 0000000000000051 No
NEWPGM BMORRIS _QRNP_PEP_NEWPGM *NEW 0000000000000052 Yes
NEWPGM BMORRIS NEWPGM *NEW 0000000000000052 No

Here's the program:

h main(newpgm) actgrp(*new)
D static s 10a

D newpgm pr extpgm('NEWPGM')
D call_again n const

P newpgm b
D newpgm pi
D call_again n const
/free
if call_again;
static = 'abcde';
newpgm ('0');
endif;
/end-free
P newpgm e



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.