|
>on 12/06/97at 12:07 PM, the Great and Grand Wazir John Carr ><74711.77@compuserve.com> said: > >>The RETURN CL command just ends the program and returns to its caller. >>Just like Setting on *INLR and doing a Return opcode in RPG. > >I am still unclear then. I'd felt that setting on *INLR and also doing a >RETURN was redundant. I'd felt that a programmer would plan on one, the >other, or neither. > >Also, is there anything wrong with RETURNing from a program and relying >upon the closing of upstream programs to close the downstream programs? > >---------------------------------------------------- >Booth Martin >--------------------------------------------------- If you're using the RPG Cycle (Remember the RPG Cycle?), setting on LR is sufficient to end your program and shut everything down: your program completes the current cycle and ends. Nowadays, with programmers writing their own logic (much to the detriment of a lot of otherwise simple programs), you -need- to SETON LRRT or SETON LR/RETURN in order to shutdown your program. Isn't there a message something like, "Compiler can't figure out how this program will end?" The solution is to make sure your program has a SETON LRRT somewhere inside. I encourage calls to RPG programs to pass at least 1 parameter: tells the called program if it is to execute or execute and shut down: CALL XXXXX PARM SHUTDOWN PARM DataToSubProgram PARM DataFromSubProgram If Shutdown is true (1, ON, whatever), the called program is expected to complete all other tasks (ie process any other passed parms and prepare return variables), then SETON LRRT (or SETON LR / RETURN). If Shutdown is false (0, OFF, whatever), the called program completes any tasks, then does a SETON RT or RETURN. This lets your program process a single transaction and quit if SHUTDOWN = 1; or lets it get called repeatedly without all that overhead to reopen and close everything if SHUTDOWN = 0. --Paul E Musselman PaulMmn@ix.netcom.com +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to "MIDRANGE-L@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.