I would need your help in understanding a behaviour in a code.One of an application processes like below (PFA the snapshot of the process and the sysout details.)
Added the process below as well. Could anyone kindly share info on why am i getting the last zero when the WS-VAR2 is moved to WS-VAR3? I can understand the reason for the first three zeroes but unable to get any idea on the last Zero.
WORKING-STORAGE SECTION.
01 WS-VAR1 PIC 9(13).9(5) VALUE SPACES.
01 WS-VAR2 PIC 9(16)V9(2).
01 WS-VAR3 PIC 9(16)V9(2).
PROCEDURE DIVISION.
1000-DISPLAY-PARA.
DISPLAY 'INITIAL DISPLAY OF THE VARIABLES:'
DISPLAY 'WS-VAR1 :' WS-VAR1
DISPLAY 'WS-VAR2 :' WS-VAR2
DISPLAY 'WS-VAR3 :' WS-VAR3
DISPLAY 'AFTER MOVING WS-VAR1 TO WS-VAR2:'
MOVE WS-VAR1 TO WS-VAR2
DISPLAY 'WS-VAR1 :' WS-VAR1
DISPLAY 'WS-VAR2 :' WS-VAR2
DISPLAY 'WS-VAR3 :' WS-VAR3
DISPLAY 'AFTER MOVING WS-VAR2 TO WS-VAR3:'
MOVE WS-VAR2 TO WS-VAR3
DISPLAY 'WS-VAR2 :' WS-VAR2
DISPLAY 'WS-VAR3 :' WS-VAR3
GOBACK.
Sysout Details:
INITIAL DISPLAY OF THE VARIABLES:
WS-VAR1 :
WS-VAR2 :
WS-VAR3 :
AFTER MOVING WS-VAR1 TO WS-VAR2:
WS-VAR1 :
WS-VAR2 :000
WS-VAR3 :
AFTER MOVING WS-VAR2 TO WS-VAR3:
WS-VAR2 :000
WS-VAR3 :000 0
(This fourth zero is in the last position of the decimal in 9(16)v9(2),Please refer attachment , it clearly states the details)
Thanks a ton in advance!
Coded