×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Jerry, there are two ways to achieve Recursion in RPG IV.

1). As others have mentioned, create the program object with ACTGRP(*NEW), i.e.

CRTBNDRPG . . . DFTACTGRP(*NO) ACTGRP(*NEW) or,

CRTPGM  . . .  ACTGRP(*NEW)

This is "pseudo recursion" and not recommended. (Overhead of creating new activation groups.)

2). Subprocedures have always been recursive - a subprocedure can call itself. Coupled with this, it is now possible to code a non-cycle, (i.e. liner main) RPG IV program which ONLY contains subprocedures. You have to nominate which subprocedure is the entry point for the program by coding,

CTL-OPT . . . MAIN(<your entry procedure>);

Another approach which I have seen used in similar circumstances to yours is to use Group Jobs. (This was many years ago.) Coupled with the use of the ATTN key, (to invoke a "hub" program) this allowed switching between various tasks in a single interactive session.

HTH,
Brian.

On 09/08/2019 16:50, (WalzCraft) Jerry Forss wrote:
Is there some secret voodoo that I can do that will allow me (in a controlled fashion) to do recursive calls.

Realistically they would only go maybe 5 deep. I could control by having 5 versions of the APIOPTIONS and know which to call but would rather not.


Jerry Forss
Information Technology Team
WalzCraft
608-781-6355 EXT 2530
jforss@xxxxxxxxxxxxx


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