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



Except that the stack is only really used for procedures. For program calls it is the same but the mechanism for parms is much more complex.


On Mar 11, 2020, at 5:21 PM, Charles Wilt <charles.wilt@xxxxxxxxx> wrote:

On Wed, Mar 11, 2020 at 2:38 PM Nick <nicola.brion@xxxxxxxxxxxx> wrote:

Il 11/03/2020 18:03, dlclark@xxxxxxxxxxxxxxxx ha
scritto:
When you pass a parameter to a procedure, only its address is
actually passed -- unless the VALUE keyword is used on that parameter
description in the PR/PI.
In which case, the variabkle is copied to a new location and *pointer to
new location* is passed to procedure.

In the end, you always passed a pointer under covert....


That's not right... you're confusing CONST and VALUE...

With CONST, the data _may_ be copied to a new location and the address
passed via the call stack...

With VALUE, the data is passed directly on the call stack.

dcl-s v1 char(100)

dcl-pr proc1;
parm char(100)
end-pr;
dcl-pr proc2;
parm char(50) const
end-pr;
dcl-pr proc3;
parm char(150) const
end-pr;
dcl-pr proc4;
parm char(75) value
end-pr;

//16 byte address is passed stack
proc1(v1);
proc2(v1);

//data is v1 is copied to a new location
// and 16byte address is passed on stack
proc3(v1);

//75 bytes of the data in v1 is passed on stack
proc4(v1);

Charles
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.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.