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



I had to try everything, and using VALUE on the pointer parameter got the error "The main procedure cannot use parameters passed by value."

I guess I'm learning a LOT today!


On 10/6/2016 2:09 PM, Charles Wilt wrote:
Yes, parms are passed by reference...

Which means this,
d OB0050AN pi
d @RETURNCODE 2a
d @CALLER 10a
d ptrPARMS *

Is expecting a pointer to a pointer....

To do what you're trying
CALL PGM(OB0050AN) PARM(&RC &CALLER &PARMS)
you'd need
d OB0050AN pi
d @RETURNCODE 2a
d @CALLER 10a
d ptrPARMS * value

But why wouldn't you just use
d OB0050AN pi
d @RETURNCODE 2a
d @CALLER 10a
d PARMS likeds(@PARMS)


Charles



On Thu, Oct 6, 2016 at 4:58 PM, Peter Dow <petercdow@xxxxxxxxx> wrote:

Yes, as soon as the code tried to reference a subfield of @PARMS, it got
an MCH3601. As does eval ptrPARMS:x in debug.

I was under the impression that parameters are passed by reference, i.e. a
pointer is passed. Is that not the case? Or I cannot reference any given
parameter's pointer by defining the parameter as a pointer?

--
*Peter Dow* /
Dow Software Services, Inc.
909 793-9050
petercdow@xxxxxxxxx <mailto:petercdow@xxxxxxxxx>
pdow@xxxxxxxxxxxxxx <mailto:pdow@xxxxxxxxxxxxxx> /



On 10/6/2016 1:52 PM, CRPence wrote:

On 06-Oct-2016 15:41 -0500, Peter Dow wrote:

On a v5r4 system I have a CLLE program with

DCL &RC *CHAR 2
DCL &CALLER *CHAR 10
DCL &PARMS *CHAR 111
CALL PGM(OB0050AN) PARM(&RC &CALLER &PARMS)

And an SQLRPGLE program that has

d OB0050AN pi
d @RETURNCODE 2a
d @CALLER 10a
d ptrPARMS *

d @PARMS e ds extname(OB0050PR) based(ptrPARMS)

When I debug the SQLRPGLE program, I can see the values passed for
@RETURNCODE and @CALLER, but for ptrPARMS it shows SPP:*NULL.

Hmm. I would think there would also be a MCH3601 exposed, somehow, to
reveal\indicate why the value is presented as *NULL; what does EVAL
ptrPARMS:X show?


What am I missing?

The interface does not match to the CALL. The CL would either need to
pass the address of (&PARMS) [i.e. CHGVAR (&cl_ptrPARMS) (%addr(&PARMS))
and then CALL … PARM(&RC &CALLER &cl_ptrPARMS)], or the RPG would need to
change to type of ptrPARMS to be 111A [and probably best also renamed to
something like data_ofPARMS].


--
This is the RPG programming on the IBM i (AS/400 and 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.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.



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.