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



Simon Coulter wrote:

On Tuesday, November 11, 2003, at 07:43 PM, Werner Noll wrote:


Hi Simon,

sorry for broaching this subject again.

I tried the example you sent me and I'm little bit confused.

When I use your prototype and specify the data parameter with keyword VALUE,
the program gets not compiled. The error message is : "*RNF3754 20 a
000600 A parameter cannot be passed by value to a program."
The only way to get the program compiled with a pointer ist the use of
keyword CONST like in my following example code:


 * Prototype for Send Data Queue (QSNDDTAQ) API
D QSNDDTAQ        PR                  ExtPgm('QSNDDTAQ')
D  p$DtaQ                        10A   Const
D  p$DtaQLib                    10A   Const
D  p$EntryLen                    5P 0 Const
D  p$Data                            *   Const
D  p$KeyLen                      3P 0 Const Options(*NoPass)
D  p$KeyData                 256A   Const Options(*VarSize:*NoPass)
D  p$AsyncRqs                 10A   Const Options(*NoPass)

D Data S 32767A

 /free
  Data = 'ABC';

CallP QSNDDTAQ('TESTQ':'NOLL':%len(Data):%addr(Data));

  Return;
 /end-free

Did I miss something on your example?


You didn't miss anything. I was wrong. What I described will work with procedures but not with programs. This appears to be an RPG IV restriction because the system certainly allows pointers to be passed by value to program objects. Just because most HLL programs don't accept pointers by value is no reason to impose this restriction.

Hans or Barbara: Why is it so?

Werner, note that changing to CONST won't help. The program will compile but it will be passing the address of the pointer which is one level of indirection more than you want. QSNDDTAQ will put crap on the data queue as a result. It looks like the only solution is to send 32K or less prior to 510. Perhaps you could send multiple entries with some sort of continuation flag?

Regards,
Simon Coulter.


Sorry, I haven't been paying much attention to this thread, so my answer might not make complete sense. But then, has that ever stopped me from answering? ;-)

So you want to pass a pointer by value, but you can't pass parms by value to another program. OK, define your parameter as 1A, but pass a BASED 1A field as parameter. Then, just set the value of the basing pointer to whatever you want. (For normal reference parameters, the address of the parameter is passed. For based fields, it's the value of the basing pointer that gets passed.)

Cheers! Hans



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.