|
2) You miss what local variable is all about. 3) If I copy them into a subproc, my sub-proc is then using global variables. According to your golden rule, that is a no no. To stick to the rule, I'll have to, as you suggested, make modification to it, which for me , is a waste of my time and QA's time. Those codes have been written and tested and there is no reason for me to create it as sub-routine and later on have to change it to sub-proc at all. Once again, I don't think I'll be able to sub-proc much at all if I have to stand by your sub-proc golden rules (where are those strick rules come from anywhere?). I'm not saying that they are bad, but live a little. -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Joe Lee Sent: Monday, August 23, 2004 5:42 PM To: rpg400-l@xxxxxxxxxxxx Subject: RE: Subroutines vs Subprocedures was RE: Indicators 2) Since these subroutines are only there to allow you to break up your code into more manageable sections. There is no difference between using them and having the code within the mainline of the program, other than to make it easier to read. 3) In this case you would either need to copy the subroutine into the subproc, or see if you can modify the subroutine so that it can be made into a subproc without creating problems such as accessing global variables from within a subprocedure. If the subroutine for example cleared the variables for a file, it would probably make sense to change it into a subproc even though the field variables are global, since file field variables are about the only global variables that should be used in a subproc, even then you should probably limit their use to a single input and output and refrain from using them as work variables. If on the other hand the subroutine really needed to be used with in the subproc, you might need to look at the subproc and see if it should really be a subproc, or if maybe it should be a subroutine. Let me try to explain it this way. A subprocedure is a section of code that can, with extremely minor modifications, be it's own program. It doesn't have to be a very capable program, but it should be self contained. A subroutine is part of a program that cannot stand on its own and is only separated for organizational purposes.
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.