|
Marc, We have written a large inquiry system that allows the user to select any inquiry from any inquiry in any order all day long. Eventually (as soon as the third call) recursion exists. Our solution is to have a 'hub' program that does all the calling. No program makes any calls, only the hub does. If program A needs program B it sets a parameter to 'B' and Returns to the Hub. The hub then calls B. If B then needs A it sets the parameter to 'A' and Returns to the Hub. The hub then calls A again. Now in our case we actually save a stack in the hub of all called programs so that the user can use F12 to return to the previous inquiry until the stack is empty. In order for several occuances of 'A' to display the proper data we use a multi-occurance DS to save the program State when a 'Call' is made and restore it when a 'Return' is made. Another completely different solution that I have seen (but DO NOT like) is for a reply be added to the system reply list for the error that comes up when a recursive program is called. The action to take is to dup the program 'A' to 'A01' and then call A01 instead of A the second time. This DOES work BUT creates a maintenance problem (you must remove all copies every time A is compiled) and has HUGE overhead because you are constantly copying programs and also are opening the same files over and over. - Larry Marc Zylka wrote: > > I'm curious about how most people handle possible recursive calling > situations. > We're running V4R1 and coding in RPG/ILE. We have a situation where program > A > is called from a menu. Program A creates a workorder and then calls Program > B, > the workorder maintenance program. From the workorder maintenance program, > one can use F6 to create another workorder, thus calling Program A. > > So, the questions: When Program A calls Program B, can I remove it from the > program stack? Can Program B remove it from the stack when it realizes > that Program A needs to be called? If program B can remove Program A from > the stack, what happens when Program B ends and Program A is no longer > there to go back to? If any of this can be done, which manual outlines how > this is done? > > Thanks in advance, > Marc Zylka ( mzylka@netpath.net ) > > +--- > | This is the Midrange System Mailing List! > | To submit a new message, send your mail to MIDRANGE-L@midrange.com. > | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. > | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. > | Questions should be directed to the list owner/operator: david@midrange.com > +--- -- Larry Bolhuis | What do you want to reload today? Arbor Solutions, Inc | (616) 451-2500 | Two rules to success in life: lbolhui@ibm.net | 1. Never tell people everything you know. +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
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.