Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why do my input parameters contain garbage when the program is called from the command line, or SBMJOB?How do I work around that CL parameter problem?

0
Posted

Why do my input parameters contain garbage when the program is called from the command line, or SBMJOB?How do I work around that CL parameter problem?

0

When I pass numeric parameters to my RPG program from the command line my program isn’t working as expected, why? The command line doesn’t know what type of parameters it is trying to pass, so it converts all numeric variables into 15,5 before passing them. Number of work arounds include: Create a command to call the RPG program, which will convert the numeric variables to the length declared in the command. Pass the numeric values as character data (I.E. PARM(‘0009’) rather than PARM(9)) This is part of a common misunderstanding of how to pass a constant as a parameter. The caller’s parameter definitions must match the called program’s definitions. The command line has no way to declare a variable so it uses a default type and length. Numeric default is packed 15, 5 decimals (8 bytes.) Character default is character 32 bytes. The manual that describes this is the OS/400 CL Programming manual, section 3.4 (Passing Parameters between Programs and Procedures) http://publib.boulder.ibm.co

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123