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



cozzi@xxxxxxxxx wrote:

Hans,

How would we pass a parameter to a proc written in RPG IV like we
can with some of the programs we call.
For example, if I want to allow a parm to be anything, numeric,
character, date, etc.  And then tell the proc on a subsequent parm
what that value is, do I code the parm as a pointer or what?

.....D myFunct        PI
     D  anytype                     *
     D   nLen                     10I 0
     D   nDec                     10I 0
     D   type                     10I 0

Could I call myFunct and pass a characte field, or a numeric field
or a data field?  If so, could I avoid using %ADDR to do it, or do I
need to wrap the variable in %ADDR?

My guess is that I would need to do pass %ADDR(CustNo), but is that
allowed when I may want to change the data in the called proc? (i.e, I don't want to use CONST).


Thanks!


Hi Bob! Scott has already said most of the things I would have said in response to your note. Use VALUE parms, and consider the complexity of the code to handle the different expected data types.


I'll just add that we do have procedure overloading in our "proposed enhancements" file. That is, allowing the coding of multiple procedures overloaded with the same name. For example, with the appropriately coded prototypes, you could have CALLP PROC(123) call real procedure PROCNUM and CALLP PROC('ABC') call real procedure PROCCHAR. But as always, it will still have to be prioritized against several dozen other worthy proposed enhancements.

Cheers! Hans



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.