|
The number is probably defined in the CL as:
DCL VAR(&NUM) TYPE(*DEC) LEN(11 0)
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:
CALL PGM(MYPGM) PARM(123)
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 INFORMATION ON THIS TOPIC
==================================
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.
|