mike
mike

Reputation: 1243

System i command line RPG CALL with packed numeric - how to format

If an RPG programs parameter is defined as PACKED(11,0)

CALL MYPGM parm(x'12345678901f')

gives a decimal data error.

Message ID MCH1202 Cause . . . . . : The sign or the digit codes of the packed or the zoned
decimal operand is in error. Valid signs are hex A-F, valid digit range is hex 0-9.

In the program dump the parameter appears as:

PACKED(11,0)         12345678901.   
VALUE IN HEX         '12345678901F'X 

Have googled but cannot find a simple explanation of format of a packed field.

Upvotes: 0

Views: 1854

Answers (2)

zero-sub
zero-sub

Reputation: 21

If the problem is really the parameter you can get around this by doing the following workaround.

Add a debug breakpoint in your programs INZSR and doing a call mypgm parm(' '). You can then add the correct value with an EVAL in debug mode.

Upvotes: 1

David G
David G

Reputation: 4014

It would probably be better to write a wrapper program that takes the parameter as numeric or character and convert it to packed.

Upvotes: 1

Related Questions