The link you posted is to the ILE C/C++ Programmer's Guide. And indeed,
for ILE C/C++ it does add the x'00' automatically to the end of the
It does not for RPG, however. You'd have to add it yourself.
One way is to write your own command. In the CPP do something like
DCL VAR(&NULL) TYPE(*CHAR) LEN(1) VALUE(X'00')
CHGVAR (&OUTPARM) VALUE(&INPARM *TCAT &NULL)
CALL THEPGM PARM(&OUTPARM)
Or better yet create the command so that it prefixes the character
parameter with its length, which is more RPG-like.
On 4/29/2022 12:50 PM, Javier Sanchez wrote:
How do you append a hex 00 byte to a text/char command line parameter?
CALL MYLIB/MYPROG PARM('My Text/Char parameter' + X'00)
The latter does not work because the plus sign would obviously be taken
the second parameter and just then the X'00' would be taken as the thirdcheck
parameter. Of course that is not what I want.
According to IBM, below, it says that I don't need to do that because the
system automatically appends a hex 00 to the text parameter. Please
out this link:https://www.ibm.com/docs/en/i/7.3?topic=command-call-call-parameter-conversions
But I wrote a small RPG program to test for a hex 00 byte and it doesn't
really do it.
My test program expects a 64-byte single parameter. Then I call it like
CALL MYLIB/MYPGM('my small text parm')
Then within my program, a test for a hex 00 like:
nullBytePos = %SCAN(X'00': text_param);
And it returns zero. What is wrong then?
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
Help support midrange.com by shopping at amazon.com with our affiliate
As an Amazon Associate we earn from qualifying purchases.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.