Decimal data error should be a rare thing for an RPG programmer who writes a single stand alone program or does not make any program call with numeric parameters.
Decimal data error is actually the error trapped by AS/400 machine at run time when it identifies a difference in the "decimal format" of a parameter in the calling and called programs. This difference is identified only when we try to assign the value of a numeric field to a different numeric type field. It may remain hidden and go un-noticed during testing if that specific variable is never used in the called program.
Given Example for Decimal Data Error: -
****************** Calling Program *****************************************
Program :- DECIMAL1
Dnum1 s 5S 1
c CALL 'DECIMAL'
c parm num1
c*
c eval *inlr = '1'
****************** End of data ********************************************
Program :-DECIMAL
c *entry plist
c parm num1 5 0
c Eval num1 = num1 + num1
c eval *inlr = '1'
****************** End of data ********************************************
Then Following Errpr occors
Decimal data error.
Function check. MCH1202 unmonitored by DECIMAL at statement 0000000003,
instruction X'0000'.
Decimal-data error occurred (C G D F).
Decimal-data error occurred (C G D F).
Could you please elaborate on this Decimal Data error
ReplyDeleteThanks
Gnaneswar
How to overcome this decimal data error? if passing parameter is packed and receiving parameter is zoned
ReplyDeleteInitialize the DS or standalone fields if you are using in program.It is the main reason of data decimal errors
ReplyDeletesolution for this?
ReplyDelete