0

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.

mike
  • 1,233
  • 1
  • 15
  • 36
  • 1
    You've got the right idea for packed. I cannot reproduce your symptoms. Are you absolutely sure the parameter is defined as packed? And are you absolutely sure the error was caused by the call and not something inside the program? – John Y Jul 07 '17 at 13:30
  • Yes, looking at the program dump the parameter is PACKED(11,0) 12345678901. VALUE IN HEX '12345678901F'X – mike Jul 07 '17 at 13:40
  • 1
    I agree with John, the parm on your call isn't the issue. The error message and the dump should tell you what statement is causing the issue. Note: need `h option(*srcstmt)` for the error to refer to the source statement number rather than the compile listing line#. – Charles Jul 07 '17 at 13:52
  • @John Y thanks, issue was caused by something else! – mike Jul 10 '17 at 08:06
  • @Charles - you were right, issue was caused by something else! – mike Jul 10 '17 at 08:07

2 Answers2

1

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

David G
  • 3,940
  • 1
  • 22
  • 30
  • many thanks for the suggestion, that's what I've ended up doing - I still would like to revise the info about numeric parms in hex format, there used to be manuals about this but can't seem to find them online, – mike Jul 10 '17 at 13:07
  • 1
    @mike This is usually where compiling a *CMD comes up. You can think of *CMD objects as a way to create a 'prototype' for CL. With a *CMD, the need for hex values pretty much goes away. – user2338816 Aug 17 '17 at 13:10
1

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.

ᗩИᎠЯƎᗩ
  • 2,122
  • 5
  • 29
  • 41
zero-sub
  • 21
  • 5