×
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.
In several web fora have I seen this topic posted, most of them do have an
explanation for some other issues which have been valuable, but I still
can't have the once-for-all answer.
I have learned that when passing parameters to CL programs, there are a few
very simple rules, like a default 32-byte minimum length for character
parameters, and also the very well known 15,5 packed decimal type for
numeric if sent in the command line.
I have an ILE RPG program pgmA which calls say another program pgmB with
four parameters:
One 32000 byte string which will hold an XML document.
A second which is a 24-byte message Id generated by MQ
A third which is another 24-byte correlation Id,
And finally a fourth which a 10-byte object name.
The four variables are created within pgmA with those lengths. They are
loaded with their respective values, and then I issue a prototyped
(dynamic) call to pgmB with those four parameters.
When I debug pgmB, and press F11 on the first parameter, I see that, for
example, my XML message is only 860 bytes long. When I inspect further
beyond that boundary, I find that the other three parameters appear within
the (supposedly) 32000-byte area of the first parameter just after the 860
bytes of my XML message. A validation in pgmB for the consistency of the
XML message, I get a parsing error, as the 860-byte message is actually NOT
followed by another 32000-860 bytes of blank spaces.
When I press F11 on the other parameters, they display their correct values
and their respective lengths.
I had to %SCAN the last tag of my XML document in order to obtain the
860-byte boundary of the message, and reassign it to another 32000-byte
automatic variable within pgmB, %TRIMming the former to load the latter
with no more garbage to the end of it. Another option was to %TRIM the XML
and append to it a X'00' as though it were a "C" string, and then %SCAN the
NULL value to get the length and then %SUBST to the local pgmB's variable.
To me this is really surprising.
How come the IBM i System appears to place as adjacent positions the four
parameters (within the same space of the first), making the first one
garbage-loaded? Very surprisingly too, I see as though it actually goes
through the first parameter from the back up to the first non-blank
character and then append the other three just to the right of the XML
message.
Thanks in advance for any clues on how to circumvent this.
Stay well everyone.
Javier.
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.