|
I don't see any problem accessing or updating global variables within a sub-procedure. Actually there are a lot of languages that do not even have a equivalent of RPG sub-routine. It all depend on design. Normally, I try to name my proc very specific to a task that it execute. I don't see a problem creating a sub-Proc call updLstChgInfo() that update some global last change info fields. Much like java's setter method. Of course, java programmer normally create a setter for each variable. -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Joe Lee Sub-procedures are great for many things, such as when you have a function that you want to be able to apply to multiple different input values. You could of course do this with a sub-routine by moving the value into a temporary variable, executing the routine, and then moving the value back, but this is ugly. However they should be limited to situations where they don't need access to global variables, if you need the data you must pass it in. Joe Lee
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.