Problem solve Get help with specific problems with your technologies, process and projects.

Real recursive call in RPGLE

This tip shows you how to call a program that is already on the program stack.

There is a way to call a program that is already on the program stack. But it is not a recommended method since...

it is resource intensive. It simply involves creating the program as an ILE program with the attribute of *NEW for activation group. Each call of the program will create a new activation group (the expensive part) but you can have a program call itself. I would not recommend this with anything that must do many calls before deciding to end. I've used this technique only to process program-references files that we rebuild nightly. A utility program we use will perform a implosion/explosion on a given programs usages (who calls it, the implosion, and what it calls, the explosion.)

Point is, this use of a program that calls itself by creating a new activation group won't be creating umpteen-zillion activations, only 5-6 on average, maybe as high as 10-15 to display the usages of some our programs. So there really isn't a lot of expense. 'Course it does help to have a max'd out 820 system.


The Best Web Links: tips, tutorials and more.

Ask your programming questions--or help out your peers by answering them--in our live discussion forums.

Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.

Dig Deeper on iSeries CL programming

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.