× 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.



There are still ways to beat a CONST even in a subprocedure call. You
can put the value in a data structure and overlay and change the
overlay value and it will let you do it. There are others but I don't
remember what they were. It is again a contract that says I will do my
best but no guarantees.

On Wed, Jan 28, 2009 at 12:14 PM, Adam Glauser <adamglauser@xxxxxxxxx> wrote:
> From: sjl <sjl_abc@xxxxxxxxxxx>
> I have this page bookmarked:
> http://www.web400.com/download/ilerpg/subprocedure_parameters2.htm>

Jeff Young wrote:
Based on that info, CONST is enforced by the compiler ONLY if you are using sub-procedures.
If you are using an external service program or just another program, then using VALUE is the only way to ensure that the parameter will not be changed on return from the call.

Is this a correct summary?

Not exactly. It's more correct to say that CONST is only enforced if
the called code uses a prototype to describe its parameters. Of course,
prototype mismatches can throw a wrench in things, but that's what /copy
is for.

Programs cannot receive parameters by value, at least up to V5R4. I
don't know if the user-defined entry procedure feature in V6R1 changes that.


David Gibbs wrote:
> IIRC, it won't even let you get the address of a parameter passed as
> const (using %addr), so you can't do direct memory manipulation via a
> pointer.

Nor can you pass it to a program or procedure that does not specify
CONST or VALUE, even if you use CALL+PARM.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



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.