I spent couple of days trying to understand it. After any arithmetics with packed or zoned decimal the result value is always positive.
when I do
VAR1 W 4 P
VAR1 = 4 - 5
DISPLAY HEX VAR1
I see the value : X'0000001F' and not X'0000001D'
The same when I do VAR1 = -1 * VAR1 and so on.
I tried different variants, getting values from a file, putting into a file, packed variables and zoned decimal.
Internally calculations are correct. If I do : VAR1 = 4 -5 + 2 , the result is +1
but if I do
RES1 = 4 - 5
RES1 = RES1 + 2
The result is +3
Any clue?
Thanks!