I am trying to convert a pic S9 (9)V99 comp-3 field which has been store with binary in it. It is display like this: 6/PS X'000000002000'.
This amount should show like this 20.00. I am trying to find the proper way to convert it to a pic -9 (9)V99 field.
Thanks
It is basically the same as Decode a Binary Coded Decimal
You create a comp-3 with 1 more decimal digit and do 'pic x' moves.
01 WS-AMT-IN PIC S9(009)V99 COMP-3.
01 WS-AMT-IN-X REDEFINES
WS-AMT-IN PIC X(006).
01 WS-AMT-OUT1 PIC S9(009)V999 COMP-3.
01 REDEFINES WS-AMT-OUT1
03 WS-AMT-OUT1-X PIC X(006).
03 PIC s9 comp-3 value zero.
01 WS-AMT-OUT-2 PIC S9(009)V99 COMP-3.
Move X'000000002000' to WS-AMT-IN-X
Move WS-AMT-IN-X to WS-AMT-OUT1-x
Move WS-AMT-OUT1 to WS-AMT-OUT-2