Hi Seniors,
I have an issue in moving a decimal field from an edited field to COMP-3 table field.
Say I have value '256.52' read as text from input file, the variable declared as PIC X(18)
After a zero insertion logic to make it an edited numeric field with PIC clause PIC 9(15).9(2), I get it as 000000000000256.52
But when I move it to the table field, defined in DCLGEN with PIC clause PIC S9(16)V9(2) USAGE COMP-3, I get it as 0000000000025652.00.
Can someone help me out?
Thanks,
AS
01 WS-SOURCE-X PIC X(18) VALUE
'000000000000256.52'.
01 WS-SOURCE REDEFINES WS-SOURCE-X
PIC 9(15).9(02).
01 WS-TARGET PIC S9(16)V9(02) COMP-3.
01 WS-NUMVAL PIC S9(16)V9(02) COMP-3.
PROCEDURE DIVISION.
MOVE WS-SOURCE TO WS-TARGET.
COMPUTE WS-NUMVAL = FUNCTION NUMVAL (WS-SOURCE).
DISPLAY 'SOURCE ' WS-SOURCE.
DISPLAY 'TARGET ' WS-TARGET.
DISPLAY 'NUMVAL ' WS-NUMVAL.