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



VALUE copies the data onto the stack rather than placing a pointer there as do all other options.

Because of this VALUE cannot be used for program calls - only procedure calls. That forces you to make the copy yourself if you want to guarantee that the called routine cannot change the data. RPG -> RPG is not too big an issue as the port can defend. But call CL or COBOL or ... where there is no such protection and the caller has no way to guarantee the integrity of their data other than by copying by hand.


On 2014-02-20, at 10:59 AM, "Anderson, Kurt" <KAnderson@xxxxxxxxxxxx> wrote:

Jon,

So in a way you're asking for both Value and Const to be allowed on a parameter.

I use Value itself so rarely, I'm not sure if I'd ever use what you're asking for. But maybe I need my mind expanded.

-Kurt

-----Original Message-----
From: wdsci-l-bounces@xxxxxxxxxxxx [mailto:wdsci-l-bounces@xxxxxxxxxxxx] On Behalf Of Jon Paris
Sent: Thursday, February 20, 2014 10:01 AM
To: Rational Developer for IBM i / Websphere Development Studio Client for System i & iSeries
Subject: Re: [WDSCI-L] CONST parameter changed?

CONST will not cause a copy of the passed variable to be made unless there is a data type/size mis-match. Consequently, since you have no such mismatch, the parameter passed is the pointer to the real atrval variable. Since that is global the rester will indeed cause it to change value.

So - Yes - it is perfectly normal. Unfortunate but normal.

I have long wanted to have a version of const that operates in similar fashion to COBOL's "BY COPY". That causes a copy of the data to be passed regardless - even when there is no type/size mismatch. I believe this capability is on the RPG wish list, but just hasn't risen to the top yet.


On 2014-02-20, at 8:07 AM, "Colpaert, Peter" <Peter.Colpaert@xxxxxxxxxxx> wrote:

Hi group,

I encountered a strange issue today when coding a procedure.

In my main procedure, I call a subprocedure:

WriteAttribute(o_pdmnbr19:
o_vernbr19:
*blanks:
atride94:
atrval20);

In my WriteAttribute procedure, I have the following interface:

Dcl-proc WriteAttribute;

Dcl-pi *n;
pdmnbr_p like(pdmnbr20) const;
vernbr_p like(vernbr20) const;
colint_p like(colint53) const;
atride_p like(atride20) const;
atrval_p like(atrval20) const;
End-Pi;


At one point in the subprocedure, I do a reset of the record format containing - among other fields - ATRVAL20.

As soon as I do this Reset, the atrval_p field goes blank also.

Is this normal behaviour or am I doing something wrong?

I thought that the CONST keyword indicated that your parameter could not be changed...

Met vriendelijke groeten / Best regards,

Peter Colpaert
Software Engineer - PLM Development Team IT Operations Cluster
Benelux, Philips IT

Philips Consumer Luminaires
Industrieterrein Satenrozen 11, 2550 Kontich, Belgium
Tel: (+32) 3/459 13 17
Email: Peter.Colpaert@xxxxxxxxxxx<mailto:Peter.Colpaert@xxxxxxxxxxx>

Working from home on Wednesdays


________________________________
The information contained in this message may be confidential and legally protected under applicable law. The message is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified that any use, forwarding, dissemination, or reproduction of this message is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original message.
--
This is the Rational Developer for IBM i / Websphere Development
Studio Client for System i & iSeries (WDSCI-L) mailing list To post a
message email: WDSCI-L@xxxxxxxxxxxx To subscribe, unsubscribe, or
change list options,
visit: http://lists.midrange.com/mailman/listinfo/wdsci-l
or email: WDSCI-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/wdsci-l.

Jon Paris

www.partner400.com
www.SystemiDeveloper.com




--
This is the Rational Developer for IBM i / Websphere Development Studio Client for System i & iSeries (WDSCI-L) mailing list To post a message email: WDSCI-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/wdsci-l
or email: WDSCI-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/wdsci-l.
--
This is the Rational Developer for IBM i / Websphere Development Studio Client for System i & iSeries (WDSCI-L) mailing list
To post a message email: WDSCI-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/wdsci-l
or email: WDSCI-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/wdsci-l.

Jon Paris

www.partner400.com
www.SystemiDeveloper.com





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.