<berendt>
If by "caller" you mean the program that calls subprocedure MySubprocedure in the service program then I'd define MyWorkVar with a D spec.
</berendt>
Could caller mean anything else in this context?
<berendt>
So the size of it doesn't really matter, does it?
</berendt>
Like 2 P 0 for example ?
The question was, How would YOU define MyWorkVar in the caller?
-----Message d'origine-----
De : rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] De la part de rob@xxxxxxxxx
Envoyé : jeudi 18 septembre 2008 16:52
À : RPG programming on the AS400 / iSeries
Objet : RE: Change a VALUE parameter
If by "caller" you mean the program that calls subprocedure MySubprocedure in the service program then I'd define MyWorkVar with a D spec.
In all seriousness
<snip>
The size of MyWorkVar does not have to match 11p2.
</snip>
So the size of it doesn't really matter, does it?
Rob Berendt
--
Group Dekko Services, LLC
Dept 01.073
Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com
David FOXWELL <David.FOXWELL@xxxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
09/18/2008 10:41 AM
Please respond to
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
To
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> cc
Subject
RE: Change a VALUE parameter
Rob,
How would you define MyWorkVar in the caller?
-----Message d'origine-----
De : rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
De la part de rob@xxxxxxxxx
Envoyé : jeudi 18 septembre 2008 16:07
À : RPG programming on the AS400 / iSeries Objet : Re: Change a VALUE parameter
How many values are you passing back? If there is only 1 I suggest using a subprocedure with a return variable instead.
D MySubprocedure PR 11p 2
D InputParm1 7p 2 const
P MySubprocedure B
D MySubprocedure PI like(returnVar)
D MyInputParm 7p 2 const
D ReturnVar s 11p 2
/free
ReturnVar=MyInputParm*.035;
Return ReturnVar;
/end-free
P MySubprocedure E
Stick the above into a service program, bind that to your other program, then your "calling" program would simply do:
MyWorkVar=MySubprocedure(42.03);
The size of MyWorkVar does not have to match 11p2.
Need more detail?
Rob Berendt
--
Group Dekko Services, LLC
Dept 01.073
Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com
Jeff Crosby <jlcrosby@xxxxxxxxxxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
09/18/2008 09:32 AM
Please respond to
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
To
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> cc
Subject
Re: Change a VALUE parameter
Ah, nevermind. I found this in the Programmer's Guide:
Passing by Value With a prototyped procedure, you can pass a parameter by value instead of by reference. When a parameter is passed by value, the compiler passes the actual value to the called procedure. When a parameter is passed by value, the called program or procedure can change the value of the parameter, *but the caller will never see the changed value*. To pass a parameter by value, specify the keyword VALUE on the parameter definition in the prototype, as shown in the figures below.
Dang. I was hoping I could have different size decimal parms in the caller/callee and get a changed value back.
--
Jeff Crosby
UniPro Foodservice/Dilgard
260-422-7531
Opinions expressed are my own and not necessarily those of my company.
Unless I say so.
Jeff Crosby wrote:
All,
I got something unexpected compiling a service program and am intrigued.
I defined one of the parms in the procedure interface like this:
D ASLPC 7P 2 Const
since I change the value of that field in the called procedure, the
compiler told me that was a no-no. Just for fun, I changed it to this:
D ASLPC 7P 2 Value
Now it compiles! Is this working as designed? I can pass decimal
parms
as VALUE, they can be different sizes in the caller/callee, and the
compiler handles it? The calling program gets back the changed value,
decimal aligned and everything?
I'm going to try some experimenting, but I just didn't think this
would work on parms that get changed.
--
This is the RPG programming on the AS400 / iSeries (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.
--
This is the RPG programming on the AS400 / iSeries (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.
--
This is the RPG programming on the AS400 / iSeries (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.
--
This is the RPG programming on the AS400 / iSeries (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.