× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



David,

What does this mean?

That way, you can't change the parameter in your program.
YOU can't but your programme certainly can!.

If a parameter is const, the subprocedure can't change it. Certainly the caller
of the subprocedure can modify a field passed to a const parameter, but that's
normal and expected. The use of CONST isn't to prevent a subprocedure from
change the parameter value, but it does allow you to write subprocedure and have
the caller know that the subprocedure won't change the content of their field,
so they can safely pass anything they want without worry.

-Bob Cozzi
www.i5PodCast.com
Ask your manager to watch i5 TV



-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On
Behalf Of Glenn Gundermann
Sent: Monday, May 07, 2007 11:29 AM
To: RPG programming on the AS400 / iSeries
Subject: Re: Another ILE question : CONST vs VALUE

David,

I use CONST for read-only parms. This way I can pass in text (e.g. 'ABC')
without using an intermediate variable, as well as expressions. You must
use CONST in both the caller and called program and then it can't be
changed.

Hope this helps.

Glenn Gundermann
ggundermann@xxxxxx
(647) 272-3295

Here's another one I can't get my head round.

I understand the difference between passing parameters by reference and by
value.

When we started ILE, the powers that be imposed on us the keyword CONST
systematically for all parameters destined to be used as input parameters.

That way, you can't change the parameter in your program. YOU can't but
your programme certainly can!.

Anyone else had this problem? What's the point of using CONST instead of
VALUE apart from performance issues? I'd say that if I see VALUE on a
parameter I'm sure that it wasn't intended to be changed in the procedure.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.