Ken,
Thanks. I see. A global variable like system time, system date, or
some random global environment variable used by the overall application
by reference could change during the call. That makes the question more
sensible. Although memory is at a premium on some systems, I've always
found that a constant SHOULD be a temporary variable that can not be
altered. I suppose I'm afforded the privilege of quick hit calls on a
high memory system, so short term memory usage hasn't been an issue for
me yet. I forget that not everyone has the budget or benefit of high
availability systems.
Address reference, although memory conservative, isn't always the best
approach, either, especially if it's a service program with coded memory
or LPAR limitations. Wouldn't it be more beneficial to utilize the
built-in process queue to throttle requests based on processor
availability in these situations? It may increase the processing time
by a few milliseconds, but wouldn't it increase the accuracy at the same
time?
Tom Armbruster
Systems Integration Manager
Travelocity On Location
http://www.showtickets.com
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Ken Sims
Sent: Thursday, November 15, 2007 1:53 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: Another ILE question : CONST vs VALUE
Hi Tom -
On Thu, 15 Nov 2007 15:21:44 -0600, "Armbruster, Tom"
<Tom.Armbruster@xxxxxxxxxxxxxxx> wrote:
Why would the CONST value change outside of the procedure during a
call,
and why would it matter? The CONST value is for processing at the time
of the call, so even if the value were say a timestamp, it would be the
value at the time of the call. Can someone provide an example as to
when a constant value provided to a program would be altered during the
called procedure and what effect it might have?
CONST doesn't always require a temporary variable. If a single field
(rather than a constant or an expression) is specified on the call and
the length and type match the prototype, there is no need for a
temporary variable.
If there is no temporary variable, and if the field on the call is
global, and if that global field is changed within the procedure, then
the value of the procedure parameter field will also change because
it's the same memory area.
It would be good if there were a keyword that could be used along with
CONST, or as a replacement for CONST, which would force a temporary
variable to always be used.
Ken
Opinions expressed are my own and do not necessarily represent the views
of my employer or anyone in their right mind.
As an Amazon Associate we earn from qualifying purchases.