|
My last flog of the dead horse. You can use subroutines within a sub procedure, and why shouldn't you? To me a subroutine within the sub procedure is much more structured and elegant than a sub-sub procedure which shares global variables within the module. More often than not some initialization needs to occur within a sub procedure, do you do the initialization in-line, in a subroutine or another sub procedure with global vars in the same module? You are looking at subroutines from an RPG perspective, monolith programs, look at them from an RPGIV perspective, logical code segments local to a sub procedure e.g. http://code.midrange.com/index.php?id=2c878cf234 Duane Christen I agree. Truly wise. All kinds of discussions of this before. Check the archives. My two cents again is that a subroutine is just a computed goto. A subprocedure is a black box or can be. You cannot encapsulate logic in a subroutine because you cannot have local variables. Every time you call a subroutine, you have to consider it's impact on the whole program. Any variable you changed could have screwed up something else. So on and so forth. Seriously, why would you still want to us a subroutine anymore unless you absolutely have to? Try to create a library of reusable code with subroutines. What a mess. NOTICE: This electronic mail transmission may contain confidential information and is intended only for the person(s) named. Any use, copying or disclosure by any other person is strictly prohibited. If you have received this transmission in error, please notify the sender via e-mail.
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.