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



"RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> wrote on 03/11/2020
06:15:55 PM:
This is a comment not specifically to Dave's post but also to the
post he was commenting on.

Programs can ONLY receive parameters by reference. The VALUE
keyword is not permitted on a PI/PR for a program. If a parm is
declared as CONST then IF it does not match the definition a copy is
made and a pointer to the copy is passed. In all other cases a
pointer to the original data is passed.

For procedures parms can be passed by reference or value. In both
cases the parameters are effectively pushed onto the stack and then
popped in the called procedure. If you pass a field by value a copy
of the actual data is pushed on the stack. There are minor
exceptions to this in a few oddball cases such as floating point
fields but it is valid to think it this way.


Sorry, I misspoke when I said "...where one program was passing a
parameter by reference (by default) but the called program expected the
parameter to be passed by value (explicitly)...". I corrected myself
later as it was a CL program using CALLPRC to call an RPG procedure -- a
service procedure, specifically. So, yes the VALUE keyword *is* allowed
on the PR/PI in such a case and, yes, in such a case the RPG procedure is
expecting an actual data value to be passed in the call stack and *not* a
pointer to the data value (as is the usual case).


Sincerely,

Dave Clark

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.