-
Notifications
You must be signed in to change notification settings - Fork 38
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
*OMIT not supported #343
Comments
We will look into *OMIT since XMLSERVICE supports it. |
Yes the documentation needs to be updated to include nodejs-itoolkit/lib/ProgramCall.js Line 141 in c4f5e29
|
@alanseiden Thank you for considering this. |
@GajenderI Please try |
We have created a PR to update the documentation after testing 'omit' in XMLSERVICE: #346 |
@alanseiden please have a look at the xml going in, what should I send in place of data if I want the parameter to be omitted? dcl-pi mypgm;
input Char(15) options(*omit);
output Char(16);
end-pi; <?xml version='1.0'?><xmlservice><pgm name="simpleomit" lib="mylib"><parm name="input" io="omit"><data type="15A">?</data></parm><parm name="output"><data type="16A"></data></parm></pgm></xmlservice>
` |
@GajenderI here is what we found so far:
The difference may be that ZZOMIT is a service program. We are looking at why this may matter. XMLSERVICE has a different code path for service program procedures. @GajenderI If you have time, try making your program into a service program with a procedure having the *OMIT and let us know if that makes a difference. |
We should create a new issue about your specific test rather than adding to this closed issue that was about documentation. |
Thank you very much @alanseiden for taking the effort. I will test it by making it a service program and let me know how else I can help in this. |
@amagid please have a look at this issue. |
The mechanism the system uses for program parameters and procedure parameters is radically different Alan so this is hardly surprising. Parms for procedures (regardless of whether local/bound/or service program) are pushed on the stack. So to get the effect of *Omit a null pointer has to be pushed on the stack. For program calls the parm pointers are passed to the system and retrieved basically by calling an internal API. So radically different code paths. |
If this can be replicated outside of nodejs-itoolkit using raw XML to XMLSERVICE, then it's likely an XMLSERVICE issue and an issue should be opened there. |
@kadler It is a XMLSERVICE issue and I'm hoping to submit a PR for it later this week, but it might only be for the mode="opm" path. The mode="ile" code path that does PASE stuff is quite a bit more complicated at first glance. |
I just realized that I'm not seeing a way with the nodejs-itoolkit to specify that a program call should be mode="opm" vs mode="ile". So if I only fix the mode="opm" path in XMLSERVICE then there's still going to be a problem because it seems to default to the mode="ile" handling. If I'm correct would @sagartyagi121 or @amagid be willing to submit a PR adding that ability here? |
As far as program calls go Brandon there should be no difference between the two. I'm actually surprised that there would be a different code path. A program call is a program call is a program call. ILE or OPM I don't think it matters. ILE diferentaion should only be needed for procedure calls.
Can you point me to the source you are studying and I'll see if I can make anything of it. I last studied XMLSERVICE a LONG time ago and it has been re-hosted since then,
Jon Paris
***@***.***
… On Nov 7, 2022, at 4:08 PM, Brandon Peterson ***@***.***> wrote:
I just realized that I'm not seeing a way with the nodejs-itoolkit to specify that a program call should be mode="opm" vs mode="ile". So if I only fix the mode="opm" path in XMLSERVICE then there's still going to be a problem because it seems to default to the mode="ile" handling. If I'm correct would @sagartyagi121 <https://github.com/sagartyagi121> or @amagid <https://github.com/amagid> be willing to submit a PR adding that ability here?
—
Reply to this email directly, view it on GitHub <#343 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ADGZWQLCBVUBG5BYAMTXTPDWHFVTBANCNFSM526FZTRA>.
You are receiving this because you commented.
|
@JonFP I'm not in the debugger right now but here's my recollection from Friday. It is pretty challenging to follow the code path through and ultimately I had to just walk through the debugger to see it.
You can see that for the mode="ile" path via PASE it's using Qp2CallPase for both *PGM and *SRVPGM objects, but mode="opm" is using _CALLPGMV for *PGM objects and a semi-generic prototype with procedure pointer for *SRVPGM function calls. I suspect the prototype might not work correctly for parameters passed by value but I haven't tried to test that yet. Also from the XMLSERVICE documentation at https://xmlservice.readthedocs.io/en/latest/functions.html#xmlservice-call-pgm note that the ILE vs OPM doesn't seem to be what you might think at face value (it wasn't what I thought):
|
I confess that I'm having a huge problem trying to understand the documentation (or rather the somewhat odd English in which much of it is written).
I really don't understand how this "but mode="opm" is using _CALLPGMV for *PGM objects and a semi-generic prototype with procedure pointer for *SRVPGM function calls." makes any sense. Not saying you are wrong that is what it says - but you can't call a service program from OPM so what the hell do ILE and OPM mean in this context? As you say it clearly doesn't have the obvious meaning and the documentation seems to be no help at all. The source itself is not commented pin any meaningful way as far as I can tell.
Jon Paris
***@***.***
… On Nov 7, 2022, at 4:51 PM, Brandon Peterson ***@***.***> wrote:
@JonFP <https://github.com/JonFP> I'm not in the debugger right now but here's my recollection from Friday. It is pretty challenging to follow the code path through and ultimately I had to just walk through the debugger to see it.
<pgm mode="ile"> *PGM - https://github.com/IBM/xmlservice/blob/master/src/plugpase.rpgle#L1526 <https://github.com/IBM/xmlservice/blob/master/src/plugpase.rpgle#L1526>
<pgm mode="opm"> *PGM - https://github.com/IBM/xmlservice/blob/master/src/plugile.rpgle#L4293 <https://github.com/IBM/xmlservice/blob/master/src/plugile.rpgle#L4293>
<pgm mode="ile"> *SRVPGM - https://github.com/IBM/xmlservice/blob/master/src/plugpase.rpgle#L1634 <https://github.com/IBM/xmlservice/blob/master/src/plugpase.rpgle#L1634>
<pgm mode="opm> *SRVPGM - https://github.com/IBM/xmlservice/blob/master/src/plugile.rpgle#L4366 <https://github.com/IBM/xmlservice/blob/master/src/plugile.rpgle#L4366>
You can see that for the mode="ile" path via PASE it's using Qp2CallPase for both *PGM and *SRVPGM objects, but mode="opm" is using _CALLPGMV for *PGM objects and a semi-generic prototype with procedure pointer for *SRVPGM function calls. I suspect the prototype might not work correctly for parameters passed by value but I haven't tried to test that yet.
Also from the XMLSERVICE documentation at https://xmlservice.readthedocs.io/en/latest/functions.html#xmlservice-call-pgm <https://xmlservice.readthedocs.io/en/latest/functions.html#xmlservice-call-pgm> note that the ILE vs OPM doesn't seem to be what you might think at face value (it wasn't what I thought):
* mode
* ile - ILE and PASE memory (default)
* opm - ILE only memory (PASE can not view)
—
Reply to this email directly, view it on GitHub <#343 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ADGZWQPSBVVZS3RVFPGYTQLWHF2XBANCNFSM526FZTRA>.
You are receiving this because you were mentioned.
|
Honestly I don't understand why there's the two code paths either. There seems to be reasons based on internal operating system architecture that I'm not sure if anybody outside of IBM really knows well. At the end of the day though, fixing the PLUGILE ilePGM() & ileSRV() for *OMIT parameters seems somewhat straightforward since it just needs to go through argv backwards instead of forwards. I'm trying to confirm if you can count on all of those pointers having been reliably initialized since it isn't being done in the PLUGILE module. If the memory is only allocated one by one then going backwards through argv in a simplistic fashion won't work. Or maybe there's a count of parameters somewhere that can be grabbed instead of walking through argv. Fixing *OMIT for PLUGPASE *PGM objects might be possible for me, not sure if I'm going to try yet. It does seem to work for *SRVPGM objects already. I'm almost certainly not going to try to fix the %PARMS issue in the PLUGPASE code though. I strongly think IBM needs to address that part. |
Tony meant OPM mode to mean using the pre-6.1 memory model. We called it the "v5r4" flag in the PHP toolkit :) |
I found an old email discussion with Tony about *OMIT and OPM / "v5r4" mode. I'll forward it to Kevin, Brandon, Jon, and anyone else interested. It refers to a discussion on the old Zend forum that Zend later deleted, but you can get the main idea from the emails. |
Oh cool, I will look for that. FWIW there's also the newer JSON based iService (https://github.com/IBM/iService-ibmi) but I don't think it supports all the features yet. |
And "Technically, mode='opm' uses non-teraspace memory compatible both ILE and OPM calls (theory)." I'll forward that one as well. |
I've submitted my PR for mode="opm" at IBM/xmlservice#64 |
Yeah, XMLSERVICE code and options are very obtuse and confusing with overloaded meanings. I did not realize there was this split in opm/ile behavior. We consciously do not make visible all the XMLSERVICE options because of this problem. I do recall having discussions with @abmusse about mode=opm/ile and deciding not to allow it. Because of this issue, we might need to do something about it, though I'd prefer to make it somewhat sensibly instead of just passing through the XMLSERVICE option to the user. |
I'll search my notes for one or two other situations where OPM mode is useful. |
I have no idea why Tony made the decision to call through PASE for program calls when CALLPGMV works great from ILE. In fact, _PGMCALL is deficient in that it requires a null-terminated list of arguments, meaning you cannot pass null pointer arguments in the middle of the list ( Calling in to PASE to call ILE service programs does make sense, because there is no generic way to dynamically call all types of ILE service program functions from within ILE. There is QZRUCLSP but it only supports up to 248 arguments and those arguments can only be a pointer or a 32-bit integer by value. There's no support for passing floats, decfloats, or any other size integers. However, basically any function can be called using |
@kadler is there any way to get _ILECALLX to generate the operational descriptor that RPG needs for %PARMS? See the issue I opened for more details at IBM/xmlservice#62 I'd be happy to add more commentary there if it would help, I've learned a lot more about the XMLSERVICE code this week since creating that. |
No, this is not supported in PASE. There's an Idea to add support, though: https://ibm-power-systems.ideas.ibm.com/ideas/IBMI-I-3080 |
What if the RPG program has a *omit param and I want to specify that in the addParm and also not pass any value to it.
Describe the solution you'd like
omit should be supported
Describe alternatives you've considered
None
Additional context
In the XMLSERVICE documentation we can see that a param option io can have values 'in|out|both|omit' but the itoolkit document says io (string()) – Valid values are in, out, or both.
https://nodejs-itoolkit.readthedocs.io/en/latest/ProgramCall.html#parameterConfig
https://xmlservice.readthedocs.io/en/latest/functions.html#pgm
The text was updated successfully, but these errors were encountered: