I need to insert minus sign before the negative decimal value.
I tried the below code but it does not looks good while displaying.
WS-NUM PIC S9(7)V99.
WS-DISP PIC -ZZZ,ZZ9.99.
MOVE -713.55 to WS-NUM.
MOVE WS-NUM to WS-DISP.
DISPLAY'WS-NUM:'WS-NUM.
DISPLAY'WS-DISP:'WS-DISP.
WS-DISP PIC -ZZZ,ZZ9.99.
MOVE -713.55 to WS-NUM.
MOVE WS-NUM to WS-DISP.
DISPLAY'WS-NUM:'WS-NUM.
DISPLAY'WS-DISP:'WS-DISP.
OUTPUT:
WS-NUM:000071355N
WS-DISP:- 713.55( // spaces present between - & 7)
WS-DISP:- 713.55( // spaces present between - & 7)
I think the spaces is present because of using Z in WS-DISP field definition.
I want the WS-DISP as
WS-DISP: -713.55
It means I want to insert spaces before the minus sign if the number of digits less than the required.
I hope I am clear with the question?