|
One caveat that Barbara Morris pointed out to me is that using "value" and "options(*nopass)" on the same variable can be dangerous. If you want a variable to be *nopass and still take advantage of the VALUE benefits, then use CONST... // This is a no-no... d myProto pr d parm1 1a value d parm2 10a value varying d parm3 10a value varying options(*nopass) // Do this instead... d myProto pr d parm1 1a value d parm2 10a value varying d parm3 10a const varying options(*nopass) Now you should use a local variable with a default value, and populate it with the parm3 value only if %parms() indicates it was passed. Joel http://www.rpgnext.com On Thu, 2003-08-07 at 16:27, rob@xxxxxxxxx wrote: > Normally I use CONST. However if you find that in the subprocedure that > the first thing you are doing is copying the variable over to another one > so that you may modify it, then I'd use VALUE. I think we both understand > that this modification is not passed back to the main program unless we > omit both VALUE and CONST. > > An example of 'maybe' a good use of VALUE: > > /free > parm=%abs(parm); > return parm*25; > /end-free > > But if you're doing: > /free > WorkVar=%abs(parm); > return parm*25; > /end-free > > Then you could get by with CONST. But then you have the overhead of > another variable, etc. And, of course I realize that you could do: > /free > return %abs(parm)*25; > /end-free > > just trying an example. > > > Rob Berendt
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.