I have a requirement to move a variable of datatype 9(0012)V9(04) to S9(14) COMP.
Fortunately, the field does not cross a value of 100.0000.
I have tried the below code but the output seems incorrect interms of positions.
01 SFD02-MBS-VAL PIC 9(0012)V9(04).
01 POSOUT-AMORTN-RATE PIC S9(14) COMP.
01 WS-RTE.
05 WS-RTE-1-6 PIC X(12).
05 WS-RTE-7-14 PIC X(04).
01 WS-RTE-R REDEFINES WS-RTE PIC 9(16).
01 WS-MBS-RTE PIC S9(14).
01 WS-FMT-RTE PIC 9(12).9(4).
01 WS-FMT-RTE1 PIC X(18).
MOVE SFD02-MBS-VAL TO WS-FMT-RTE.
MOVE WS-FMT-RTE TO WS-FMT-RTE1.
UNSTRING WS-FMT-RTE1
DELIMITED BY '.'
INTO WS-RTE-1-6 WS-RTE-7-14.
IF WS-RTE-R(1:2) = ZEROS OR SPACES
MOVE WS-RTE-R(3:14)TO WS-MBS-RTE
END-IF.
MOVE WS-MBS-RTE TO POSOUT-RATE.
01 POSOUT-AMORTN-RATE PIC S9(14) COMP.
01 WS-RTE.
05 WS-RTE-1-6 PIC X(12).
05 WS-RTE-7-14 PIC X(04).
01 WS-RTE-R REDEFINES WS-RTE PIC 9(16).
01 WS-MBS-RTE PIC S9(14).
01 WS-FMT-RTE PIC 9(12).9(4).
01 WS-FMT-RTE1 PIC X(18).
MOVE SFD02-MBS-VAL TO WS-FMT-RTE.
MOVE WS-FMT-RTE TO WS-FMT-RTE1.
UNSTRING WS-FMT-RTE1
DELIMITED BY '.'
INTO WS-RTE-1-6 WS-RTE-7-14.
IF WS-RTE-R(1:2) = ZEROS OR SPACES
MOVE WS-RTE-R(3:14)TO WS-MBS-RTE
END-IF.
MOVE WS-MBS-RTE TO POSOUT-RATE.
When SFD02-MBS-VAL is 93.0720 I would expect 9307200000 in POSOUT-RATE. But I receive 930720.
Could anyone help?