What will be the value of B after executing the below code snippet? 77 A PIC 9(4)V999 VALUE 9902.852. 77 B PIC 9(4)V9(2) VALUE 99.85. PROCEDURE DIVISION. MULTIPLY A BY 30.5 GIVING B ROUNDED STOP RUN.
-
B will have 2
-
B will have 0002000
-
B will have 2662311
-
Program will abend
D
Correct answer
Explanation
The program will abend due to a size mismatch. A has PIC 9(4)V999 (4 integer + 3 decimal places = 7 digits total with 3 decimals). After MULTIPLY by 30.5, the result needs 2+log10(9902.852) + log10(30.5) ≈ 6 digits before decimal plus 3 decimal places = 9 digits. B has only PIC 9(4)V9(2) (4 integer + 2 decimal = 6 digits total). The result overflows B's capacity, causing an abend. Option B shows raw internal value but ignores the overflow condition.