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



So, provided my prototype and the PI of the called procedure match, if I specifiy CONST, the compiler will *never* allow the value to be changed in the called procedure?

If that is the case, then the only way I could have a problem is if I specified CONST in the prototype, but did not specify it in the PI of the called procedure and the procedure was in a service program.

Is this correct?
If so, then I do not understand the issue the OP was having.

Thanks,
 
Jeff Young
Sr. Programmer Analyst
IBM -e(logo) server Certified Systems Exper - iSeries Technical Solutions V5R2 
IBM  Certified Specialist- e(logo) server i5Series Technical Solutions Designer V5R3
IBM  Certified Specialist- e(logo)server i5Series Technical Solutions Implementer V5R3
  
 






________________________________
From: Adam Glauser <adamglauser@xxxxxxxxx>
To: rpg400-l@xxxxxxxxxxxx
Sent: Wednesday, January 28, 2009 2:14:24 PM
Subject: Re: CONST and VALUE revisited

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.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.