|
RE: Re: dynamic program CALLS >>Vernon Hamberg wrote: >> I suspect every call to a CLP requires reinitialization—along the lines of >> turning on *INLR in RPG. >> > James Kilgore said > That's sort of what I've accepted (heard it before), but it made me curious of > the purpose of the RETURN code. > If it doesn't return without ending, the best I've been able to figure out is > that it is preferred to a GOTO to a labeled ENDPGM. > But then again, this "common knowledge" may be unfounded. I'm sure that >someone > on this list will set us straight. :) > CLP is recursive. I believe it still uses the PASA(Program Automatic Storage Area) which means its variables get "recreated" with each call. 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. Again there may be a difference between Program reinitialization and repeatedly resolving to the same object & checking authority when doing repeated calls (Via a variable name) to the same program. The difference between the RETURN CL command and the ENDPGM CL command is this; The code after the RETURN CL command may or may not be executed based on your program logic. The code after the ENDPGM CL command is ignored during the compilation process. It doesn't exist in the object code. So any code you put after the ENDPGM command turns out to be just "comments" . (People from the SYS/36 and OCL may remember putting comments after the end of the OCL Proc because the interpreter never processed those statements - performance improvement. Instead of putting the comments at the top of the program) Same type of thing here as far as the ENDPGM CL command is concerned. John Carr EdgeTech +--- | 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.