Call Again and Again and Again…
October 5, 2011 Paul Tuohy
Note: The code accompanying this article is available for download here. In programming terms, recursion is the process whereby a function may call itself. Traditionally, this is something we are not used to in RPG. Programs and subroutines cannot call themselves. Or if you did somehow manage it (and you could), you would get unpredictable results. But the introduction of subprocedures opened up the possibility of using recursion because subprocedures can call themselves. It is usually very difficult to come up with practical examples of using recursion, and most of those examples are usually very specific to an application. |