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



Thank you, I had no idea ...

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

One other option that I find works well in some cases is to pass the file as a parm. That can be done between programs as well as from main program to subprocedures (local and SrvPgm).

Kind of like a shared open data path without the death wish implications.

I wrote up one interesting approach to using this facility here: http://www.itjungle.com/fhg/fhg032112-story01.html


On 2014-02-21, at 9:44 AM, "Anderson, Kurt" <KAnderson@xxxxxxxxxxxx> wrote:

I've been in the habit of always performing file I/O through local data structures. I also Qualify all files which prevents the file's fields from being defined globally.

I'm a huge fan of qualifying. Some people may not like it because
there is extra "typing." (Not so much when you use autocomplete.)

As Darren said, you can also define files locally. I've done that a few times. The main complaint I get when I do that is from people who want to look at the top of a program to see what files it uses. The compromise was to also add a comment in the F-specs to list all the files defined locally.

-Kurt

-----Original Message-----
From: wdsci-l-bounces@xxxxxxxxxxxx
[mailto:wdsci-l-bounces@xxxxxxxxxxxx] On Behalf Of darren@xxxxxxxxx
Sent: Friday, February 21, 2014 7:54 AM
To: Rational Developer for IBM i / Websphere Development Studio Client
for System i & iSeries
Subject: Re: [WDSCI-L] CONST parameter changed?

You can define files locally, which I did in a couple programs as a test.
The file was a display file, and it complicated the program more than it benefitted it. It was a display file, which I think might be worse than a disk file for the way you have to define the record formats in different ways.




From: "Colpaert, Peter" <Peter.Colpaert@xxxxxxxxxxx>
To: Rational Developer for IBM i / Websphere Development Studio
Client for System i & iSeries <wdsci-l@xxxxxxxxxxxx>
Date: 02/21/2014 12:44 AM
Subject: Re: [WDSCI-L] CONST parameter changed?
Sent by: wdsci-l-bounces@xxxxxxxxxxxx



First of all, my sincere apologies for posting to the wrong forum. It
was a rough day yesterday ;-)

Kurt,

The global variable is a field of a file I'm updating, so I don't see any other way to define it.

I solved the issue by copying atrval20 to a work variable and using that when calling WriteAttribute.

Now it works like a charm.

Yay, I learned something new today...

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

Working from home on Wednesdays

-----Original Message-----
From: wdsci-l-bounces@xxxxxxxxxxxx
[mailto:wdsci-l-bounces@xxxxxxxxxxxx] On Behalf Of Anderson, Kurt
Sent: donderdag 20 februari 2014 14:49
To: Rational Developer for IBM i / Websphere Development Studio Client
for System i & iSeries
Subject: Re: [WDSCI-L] CONST parameter changed?

Const prevents the procedure from changing the value directly. But it's
not saying you can't change the global variable that was passed into the procedure.

As Darren said, passing a value by Const means that it's passing a pointer.
So atrval_p isn't really changing at all. It's still pointing to the same spot in memory, it's just that you've changed what's in memory by changing a global variable.

Quick fix: use Value instead. I groan as I recommend that. Just be
aware of the properties of Const and Value and you should be fine.
(FYI: Value will pass the parameter as the data value, not as a
pointer.)

Longer fix: get away from what you're doing with setting global variables from a procedure the best you can. Otherwise you may run into that issue again somewhere else (or not even realize you did it and cause a problem in production code).

-Kurt

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

You might get better response in the RPG list. This list is more for RDi discussions.

I will say that atrval20 is probably defined as a global static variable in your program. It is then passed by reference using a pointer to WriteAttribute. Then you are resetting the global variable, which subprocedures have access to. I would say that this has always been possible, although CONST doesn't always pass the variable as a reference, so the behavior might seem sporadic.




From: "Colpaert, Peter" <Peter.Colpaert@xxxxxxxxxxx>
To: Rational Developer for IBM i / Websphere Development Studio
Client for System i & iSeries <wdsci-l@xxxxxxxxxxxx>
Date: 02/20/2014 08:14 AM
Subject: [WDSCI-L] CONST parameter changed?
Sent by: wdsci-l-bounces@xxxxxxxxxxxx



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.


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

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

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.