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')


The Best Web Links: tips, tutorials and more.

Visit the ITKnowledge Exchange and get answers to your developing questions fast.

Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.

This was first published in April 2005

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: