Manage Learn to apply best practices and optimize your operations.

Decimal data error

I am passing an 11 digit number (no decimals) around in a CL program, when calling it from an RPG. Interactively this works fine, but when I try to submit the CL, the submitted job goes to message wait, saying that there is decimal data error, and it is the 11 digit number that has the problem. Is there a way to overcome this? Would CL ILE help?

The number is probably defined in the CL as:


When you call the CL from your RPG program, it is declared in the RPG as 11,0 packed decimal. This works.

But when you call the CL from SBMJOB or a command line, you can't pass the number as just a naked number:


or even in quotes:

CALL PGM(MYPGM) PARM('00000000123')

That's how you get decimal data errors. You have to pass the number as a packed numeric string:

CALL PGM(MYPGM) PARM(X'00000000123F')

This is obviously inconvenient, if the value is subject to frequent change. But if it's going to remain fairly constant on the SBMJOB command, you can live with it.

The only other way is to declare the parameter as a *CHAR of 11 bytes (in your RPG too) and convert the incoming value into a numeric field for the CL to use correctly. CHGVAR can handle that, if the character variable contains valid numbers. The call will then be:

CALL PGM(MYPGM) PARM('00000000123')

More on this topic

The Best Web Links: tips, tutorials and more.




Dig Deeper on Data backup, storage and retrieval on iSeries

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.