|
> When you return a value from a procedure are you returning the value or a > reference to the value? Assuming that you're referring to data returned by the "return" op-code, rather than a parameter, you're ALWAYS returning a value. Even if you return a pointer, you're returning the value of the pointer. (Though, granted, the address stored in the pointer will likely be used as a reference.) > I have several procedures in a service program that are used to access > different fields in a database and I want to make sure that if I return the > database field that it wont change if the service program is used to get a > value from a different record. Also I thought about moving the value from > the field to a work field in the procedure but I was worried the memory > could be reclaimed. It won't change, unless you're passing a pointer and basing a variable on that pointer. (Or doing something equally obvious, like using the same variable to store the return value for subsequent calls.) Your srvpgm may not perform well -- depending on the fields and how often you're doing this -- but then, that may not be one of your goals.
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.