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



Phil,

I'm not sure what the author is saying here - whether or not there is a
RETURN statement, if the procedure is several levels deep (i.e. it has
recursed multiple times), it will still have to travel back though each
prior level on its way to the top. Short of using the setjmp() and
longjmp() operations to jump straight out, there's nothing that can be done
about this. That being said, it's not what I would call a problem, as such.

As far as reaching a system limit, this would have nothing to do with
long-running jobs specifically - it would simply be the maximum number of
recursions - I don't know what that is, but I'd guess its probably 65535.

Rory


On Thu, Feb 14, 2013 at 10:50 AM, ssc1478 <ssc1478@xxxxxxx> wrote:

I recently read this article:
http://ibmsystemsmag.com/ibmi/developer/rpg/rpgle_recursion/

and was interested in this comment:
"Even though this procedure doesn’t return a value, it’s a good idea to
have a return statement on the end so the program can exit right away after
it reaches the end of MGACCM. Otherwise, it will unwind itself by going
from the Endif line to the end of the procedure for as many records as were
written."

What I've noticed is that each recursive call puts an entry on the call
stack, and at the end it "unwinds" down the call stack until it can exit
the subprocedure. I thought the author's comment above was addressing
that, but it made no impact on my test pgm.

Is that the expected behavior? I'm worried about a long-running job
running into a system limit. Does anyone know?

Thanks,
Phil
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.