× 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.

Javier, you need to educate yourself on how parameters are passed on IBM i.

Basically all program (PGM object) calls are by reference. ALL. The only thing that is passed is a pointer to the data. So if you pass 10 characters but the called program expects 20 you will see 10 spurious characters in the parameter received. They will be the 10 characters in memory that follow the 10 of the actual parameter.

Try reading this https://www.itjungle.com/2016/11/29/fhg112916-story01/

and this: https://www.itjungle.com/2017/02/20/guru-parameter-passing-fundamentals-programs-versus-procedures/

Also be aware that when passing a parameter from the command line there are system-wide rules that determine how the parameters sent are effectively defined. You can find a full description of the rules here: https://authory.com/JonParisAndSusanGantner/The-Mystery-of-the-Command-Line-Parameters-af036a9909e7d4323a1e16a55440f6c70

Hope this helps.

Jon P.

On Apr 29, 2022, at 1:50 PM, Javier Sanchez <javiersanchezbarquero@xxxxxxxxx> wrote:

Hi folks:

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 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:


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,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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

This mailing list archive is Copyright 1997-2023 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.