|
>> I did not think I would solve this one, so I had already started planning the program changes to push and pop the global variables that needed to be saved into a multiple occurrence DS, and use a sub-procedure recursion instead. If this is a production program and you do a lot of these recursive calls you may still want to go down this route. *New does not give true recursion as there is no access to global variables between the levels. Using the subprocedure approach, there is no need to save any global variables as they will retain their values anyway. The only things you might need to preserve in this situation are your file positions and or record variables since those would be changed by subsequent reads. It sounds though as if perhaps you don't actually need access to globals. On V5R2 and recursion becomes more practical even when input data is required as the only thing you need to preserve is whatever key information you need to get back to any records you are planning to update. This works because you can use a resulting DS array element on the read/chain to keep the record information by invocation level very easily. As Joe noted earlier, creating a new AG is a very expensive process and not something you want to do often. Normally *New is used for the root program (say a menu) of a group so that everything is cleaned up when you return. Not only does it take time to create the new AG, it will take time to tear it down as you return, Jon Paris Partner400 www.Partner400.com www.RPGWorld.com
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.