|
rpg400-l-request@xxxxxxxxxxxx wrote: > 1. RPG ILE Recursivity RNX8888 (Andre Dubreuil) > >First I must say that I often search and read these forums. Thank you all >for your help. > >Here's something I would appreciate your help with. > >>From what I've been reading... RPG ILE does not support recursivity. >That is an RPG program calling itself either directly or indirectly. Andre: As others noted and you've seen, recursive ~program~ calls can be done. But they can also be expensive. Activating a *NEW activation group adds overhead that might be too costly. However, recursive ~procedure~ calls can often be a better fit. I put a very trivial example of a procedure calling itself at [ http://code.midrange.com/index.php?id=5dae31f5e4 ]. A driver ILE CL proc calls a RPGLE proc. The RPG calls itself recursively. The RPG adds 1 to its input parm value and calls itself until the value reaches 5. When it's 5, it returns the value back up through the procs until it gets back out to the CL. The CL does DMPCLPGM to show that 5 was returned. The example isn't elegant, but it works. Tom Liotta
As an Amazon Associate we earn from qualifying purchases.
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.