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




Here's my definition of the procedure.

D CostRecipe PI
D pCono 3 Const
D pCpy 3 Const
D pRecipe 11 0 Const
D pRecipeQTY 17 6 Const
D pItem 9 Const
D pParent 9 Const
D pQtyS 9 0 Const
D pTotQty 17 6 Const
D pClcQty 17 6 Const
D pServings 24P12 Const


As you can see all fields are defined as Const. I must have forgotten that
Const is read-only pass by reference. I was thinking that it was
read-only by value. Anyway I fixed the issue by moving the parms to local
variables in the procedure (but could have done so by changing Const to
Value).

You mean to tell me that I'm the only one that likes bugs in my produce? I
must say I love those tiny insect in the middle of a strawberry! :)

Michael Schutte
Admin Professional

We've wrapped up a whole new breakfast adventure in Bob Evans BOBurrito.
Premiering at 5.99. For more information and to enter the FREE Breakfast
Every Week for a Year Sweepstakes ($500 value), visit www.BOBurrito.com


rpg400-l-bounces@xxxxxxxxxxxx wrote on 03/16/2009 05:11:22 PM:

Hi Michael,

I thought that the parm list was local to the call level? So that when
return from the recursive call, your parm list hadn't changed in the
instance?

That'd be true if you're passing the contents by value. (i.e. with the
VALUE d-spec keyword on your prototype)


When I returned back to the first instance the parm variable was the
value
of the last instance.

Sounds like you're passing by reference.


I obviously thought I was okay with using the parms in the procedure,
but I
guess I need to move them to local variables in the produce.

Produce? Do you mean procedure? heh... bugs in a procedure are one
thing, bugs in produce are quite another :)

Anyway, what you really need is to understand the difference between
passing by reference and passing by value, and use the correct one for
what you're doing.
--
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.