|
On Fri, 19 Jan 2007, rob@xxxxxxxxx wrote:
DCL VAR(&RUN) TYPE(*CHAR) LEN(1) CALLPRC PRC(DCADPTRP) RTNVAL(&RUN)
RPG and CL use a different parameter passing convention for 1-byte return values.
You can tell RPG to use CL's parameter passing convention by specifying EXTPROC(*CL:'MyProc') on the prototype. The *CL tells it to use CL's parameter passing convention so that the two are compatible. Warning: Any RPG routines that are already calling this subprocedure must be re-compiled and re-bound if you make this change.
Alternately, you can define the returned variable as TYPE(*CHAR) LEN(2) in the CL program. Then use %SST to extract the 1-byte value that the RPG program has returned. This way seems a little more like "black magic", but it doesn't require you to change the RPG side, so you won't break compatibility with existing programs.
This is a very frequently asked question. If it's not already in the Midrange.com FAQ, can someone please add it?
As an Amazon Associate we earn from qualifying purchases.
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.