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




If this module is called several times in the same activiation group,
and RETURNs several times in the middle of the DOW loop, are there any
consequences to subsequent calls?  I just can't help but think there
is going to be some 'stack overflow' or something.

The RPG compiler is smarter than that. I'm pretty sure that a loop doesn't involve putting anything on a stack, so you wouldn't get a stack overflow.


But even if it did, the RPG compiler is smart. It knows when it needs to pop additional entries from the stack -- for example, if you use GOTO to get out of a subroutine, it knows that the address that was pushed onto the stack by the EXSR needs to be popped off. (even though you didn't execute an ENDSR or LEAVESR)

In your case, however, the loop doesn't put anything on the stack, so there's no danger. The call to the subprocedure puts stuff on the stack, but the return will remove it, so there's no danger there either.

All static variable values are being handled to accomodate this, but it just doesn't feel right.

You don't need to do that,


Should I not be in a loop while RETURNing?

It could be argued that it's a bad STYLE choice to return in the middle of a loop -- but that's a whole different discussion. Returning from the middle of a loop should work just fine.




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.