Trying to do that from a "Command Line" would not be easy. A null would not be a valid character you can type into any 5250 session.
So you would have to convert the entire string into hex and pass that in the call command.

CALL MYLIB/MYPROG PARM(X'D4a840e385a7a361c388819940978199819485a3859900')


Also, You can't concatenate within the call command.

You can create another variable and set it to the value you want, then pass that to the call.

DCL VAR(&PARM) TYPE(*CHAR) LEN(64)
DCL VAR(&NUL) TYPE(*CHAR) LEN(1) VALUE(X'00')

CHGVAR VAR(&PARM) VALUE(&PARM |< &NUL)

CALL PGM(TESTPGP) PARM(&PARM )


Keep in mind that if you fill all 64 characters of the field with text, you won't get the null character.

If you want to make sure to always get the null, then you would want to increase the parm to 65 Inside the RPG program and the CLLE program.
Then always set the 65th character to the null.


DCL VAR(&PARM) TYPE(*CHAR) LEN(65)
DCL VAR(&NUL) TYPE(*CHAR) LEN(1) VALUE(X'00')
CHGVAR VAR(%SST( &PARM 65 1) ) VALUE(&NUL)


It may be more helpful to explain "why" you thought a null character was necessary.

Chris Hiebert
Senior Programmer/Analyst
Disclaimer: Any views or opinions presented are solely those of the author and do not necessarily represent those of the company.

From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Javier Sanchez
Sent: Friday, April 29, 2022 11:50 AM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: A command line char parameter with a hex 00 last byte


Hi folks:



How do you append a hex 00 byte to a text/char command line parameter?



Example:



CALL MYLIB/MYPROG PARM('My Text/Char parameter' + X'00)



The latter does not work because the plus sign would obviously be taken as

the second parameter and just then the X'00' would be taken as the third

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 check

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

this:



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?



TIA.



Javier.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.