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



Confusing? Perhaps.
But if you write a proc for general use, in RPG IV, you are (currently) limited
to 64k of data for parameters. With XML and the like, you may need to exceed
that limitation. So the address-of may be the way you access that data and pass
it to a subprocedure.
A field as the parameter could be used for 80 to 90% of the situations, but then
when the user needs to go beyond that, a pointer-to would be specified.
Therefore there doesn't need to be two versions of the same procedure. 

foo(szName);
foo(szData);
foo(szMy64kField);

 Qusptrus('QGPL/MYSTUFF' : ptrVar : apiErrorDS);
 foo(ptrVar : nDataLen);

The second parm could be optional unless a pointer is passed in.


-Bob Cozzi
www.i5PodCast.com
Ask your manager to watch i5 TV



-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On
Behalf Of Scott Klement
Sent: Friday, March 09, 2007 1:42 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: IFS Open Help...

Hi Bob,

Qusptrus('QGPL/MYSTUFF' : pData : apiErrorDS); 
foo(pData : 1000000);

This passes the address of the data in the user space, and tells the
subproc that it is 1 megabyte in size. No conversion is performed and
the pointer to that data is passed to the foo() subprocedure.

I completely disagree. Your code uses a separate parameter (the length 
parameter) to dictate the length of the string.   It does not use a 
null-terminator, and therefore should not be coded with options(*String).

Just code it as a normal pointer.  When you want to pass a variable 
directly, use %ADDR().  When you want to write data from a pointer (such 
as your user space example) then pass the pointer directly.  It's much 
easier to read and understand, and doesn't confuse people who then start 
thinking that options(*string) requires %addr().

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.