-
Notifications
You must be signed in to change notification settings - Fork 35
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
ProgramCall - Function that returns a packed variable #391
Comments
Hi there!
This might be a long shot but could you try adding a decimal point? pgm.addReturn({type: '20p0', value: '0.'}); from the screenshot it seems like the value is being interperted as hex for some reason where it should default to not interpreting the value as hex. See: https://nodejs-itoolkit.readthedocs.io/en/latest/ProgramCall.html#returnConfig Another suggestion would be to explicitly set hex to off pgm.addReturn({type: '20p0', value: '0', hex: 'off' }); |
Hi @abmusse Thanks for the suggestions but unfortunately no luck. I get the same error on both suggestions. Do you know how I could debug this on IBM I? |
ah I see
This may be bug with xml-service not returning packed decimal types properly from service program calls. I think we need to debug by determining whether this an issue returning packed decimal from ILE call or xml-service having issues handling returning the packed decimal. Some ideas for debugging:
|
Hi @abmusse Thanks for the suggestions, it looks like this isn't a bug with this but with the service module I was calling is doing something somewhere that it causing it to fall over. I've managed to get a working packed variable back by creating a basic service program that just returns the packed var.
<pgm name='SERVICETRC' lib='library' func='GETPACKED' error='ON'>
<parm by='ref'>
<data type='2a'>AA</data>
</parm>
<return>
<data type='5p0'>1</data>
</return>
<success><![CDATA[+++ success library SERVICETRC GETPACKED ]]></success>
</pgm> |
I just re-opened as it looks like it's actually an issue with the length of the packed type field. Doing that service program with a packed variable of anything over For example: This works fine and returns:
But this doesn't:
Does the XMLSERVICE store the return value in a field that has a maximum character limit or something of that sort? |
I was gonna say when reading your comment where you closed the issue, might want to try with an even sized packed decimal. Size of a packed(N) in bytes is (N + 1)/2, which has the effect of packed decimals with an even number of digits being rounded up. So a packed(15) fits exactly in 8 bytes (15 nibbles plus sign nibble = 16 nibbles = 8 bytes), while packed(16) would be rounded up to 9 (16 nibbles plus sign nibble = 17 nibbles = 8.5 bytes -> 9 bytes). It's likely that XMLSERVICE is calculating the space for even-sized packed decimal values incorrectly. We'll probably need to do some debugging with XMLSERVICE here to investigate further. |
Hi @kadler I've just tried that same code with both |
Huh. Definitely think we'll need to debug in to XMLSERVICE to figure out what's going on. |
I'm trying to call a function on a service program that returns a packed variable but I can't seem to get it working.
I get this error message:
Would someone be able to let me know what I'm doing wrong here? I believe it's something to do with my return method call as if I remove this the call goes through successfully.
Node: v20.12.2
XML Toolkit 2.0.2-dev
The text was updated successfully, but these errors were encountered: