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



Thanks to Scott, Jon, and Buck for great explanations of what is happening
and the options.  I think I'm going to go ahead with the CONST option so
that I can retain the literal passing.  This procedure is used very little
from CL.

I understand now why it operates the way it does, but doesn't this seem like
a fault to anyone else?  I mean the whole idea of ILE is supposed to be to
have all these little interchangeable parts and it shouldn't matter what
language they are written in...

Ho hum, at least now I know - RTFM :-)

Joel R. Cochran
Director of Internet Services
VamaNet.com
(800)480-8810
mailto:webmaster@vamanet.com


> -----Original Message-----
> From: Scott Klement [mailto:klemscot@klements.com]
> Sent: Monday, April 29, 2002 5:02 PM
> To: 'rpg400-l@midrange.com'
> Subject: Re: CLLE calling RPGLE sends bad parms???
>
>
>
> On Mon, 29 Apr 2002, Joel R. Cochran wrote:
> >
> > I'm trying to call an RPGIV sub-procedure from a CLLE
> program and return a
> > value.  When I step through the program in Debug, the
> passed parameter is
> > full of garbage in the sub-procedure...
> >
> [SNIP]
> >              CALLPRC    PRC(#GETSYS) PARM(&TYPE) RTNVAL(&AUDITVALUE)
> [SNIP]
> > d #getSys         pi            10
> > d  type                         10    value
>
> You're telling the CL program to pass the parameter by
> reference.  You're
> telling the RPG program to receive the parameter by value.
>
> So what is the CL program passing?   An address.  Just something that
> tells whomever is receiving the parameter where to look for the data
> in main storage.   It just says "if you go to location X,
> you'll find my
> data".
>
> The RPG procedure has been told that it's receiving by value.
>   It thinks
> that the actual data will be passed, instead of an address.
> It takes the
> address that the CL program passed, and happily stores it
> into the TYPE
> variable.  It never looks at the memory that the CL program
> was trying to
> reference because it believes that it's receiving the VALUE
> of the data.
>
> (I think that's a pretty clear explanation -- if not, ask me for more
> info)
>
> AFIAK, CL cannot pass by value.   So probably the best way to
> fix this is
> to change the RPG to CONST.  If this procedure is in use by
> existing RPG
> programs, you might need to define a wrapper proc that simple receives
> a CONST parm, and calls the other proc by VALUE...
>
> [SNIP]
> > BTW, this works fine when called from another RPGIV procedure...
> [SNIP]
>
> That's only because you're telling the RPG proc to pass the arguments
> by VALUE;   If you told them to pass it by reference, you'd have the
> same exact problem. :)
>
> Anyway -- I hope this message helped you understand not just what you
> did wrong, but also how it works...
>
> _______________________________________________
> This is the RPG programming on the AS400 / iSeries (RPG400-L)
> mailing list
> To post a message email: RPG400-L@midrange.com
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
> or email: RPG400-L-request@midrange.com
> 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 ...

Follow-Ups:

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.