Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call to service program functions don't have %PARMS() set properly - ie with *NOPASS parameters and <pgm mode="ile"> #62

Open
brandonp42 opened this issue Nov 4, 2022 · 3 comments

Comments

@brandonp42
Copy link

It doesn't seem like service program functions are getting the %PARMS set properly when called. You can see this with the XMLSERVICE(ZZNOPASS) function for example: (I ran this in ACS Run SQL Scripts). I've tried on both my work system and PUB400 with the same result in both places.

call qxmlserv.iplug4k('*NA', '*HERE',
   '<?xml version="1.0" ?>'
|| '<script><pgm name="ZZSRV" lib="XMLSERVICE" func="ZZNOPASS">'
|| '<parm><data type="10a" var="myName">Ranger</data></parm>'
|| '<parm><data type="10a" var="yourName">Buddy</data></parm>'
|| '<return><data type="50a" var="blah" varying="on">asdf</data></return>'
|| '</pgm></script>'
, '');

Here's the output I receive back:

Output Parameter #4 (C0) = <?xml version="1.0" ?><script><pgm name="ZZSRV" lib="XMLSERVICE" func="ZZNOPASS">
<parm><data type="10a" var="myName">Ranger</data></parm>
<parm><data type="10a" var="yourName">Buddy</data></parm>
<return><data type="50a" var="blah" varying="on">my name is -1 Ranger NOPASS</data></return>
<success><![CDATA[+++ success XMLSERVICE ZZSRV ZZNOPASS ]]></success>
</pgm></script>

I've looked at the source file PLUGILE ileSRV() and don't see anything obvious, but I'm not sure how the %PARMS works behind the scenes. Should it be doing something extra before calling the service program sub-procedure to tell the OS how many parameters are being passed? Also I suspect the code where it iterates through argv to set argc might not work properly for *OMIT parameters with a *NULL if there are subsequent parameters filled in, but I haven't been able to test that yet.

@brandonp42
Copy link
Author

brandonp42 commented Nov 4, 2022

Take this with a grain of salt because I can't actually use the system debugger on the XMLSERVICE right now, but FWIW I think the service program calls either need a SETALLEN before the prototyped call or use SETALLEN & CALLX instead of the prototype call.

Also it might be possible to use CALLPGMV with a service program function but I wasn't sure based on the IBM documentation for it. If you can do that it would be very similar to the call *PGM stuff instead of doing something totally different.

Update: It turns out that the service program is being called via the PASE functions, not the ILE functions as I originally thought. It's ultimately using Qp2CallPase(). The RPG documentation at https://www.ibm.com/docs/en/i/7.3?topic=functions-parms-return-number-parameters indicates that %PARMS needs an operational descriptor to be passed but I haven't found anything yet that indicates how one might do that from "another ILE language". Even though the XMLSERVICE is actually RPG that caveat applies because it's not calling things the normal way a regular RPG program would.

@brandonp42 brandonp42 changed the title Call to service program functions don't have %PARMS() set properly - ie with *NOPASS parameters Call to service program functions don't have %PARMS() set properly - ie with *NOPASS parameters and <pgm mode="ile"> Nov 9, 2022
@brandonp42
Copy link
Author

Does anybody know if we converted the Qp2CallPase() calls to use _ILECALLX would it be possible to somehow generate the operational descriptor that RPG needs to support %PARMS? Ie maybe if the argument list is prepared with build_ILEarglist() first?

@brandonp42
Copy link
Author

With the latest comment on the NodeJS iToolkit issue it seems like this is not possible to fix without IBM i Idea 3080 (https://ibm-power-systems.ideas.ibm.com/ideas/IBMI-I-3080) being implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant