What is the PIC representation for +123.876?
-
PIC S9(3).999
-
PIC 9(3).999
-
PIC S9(3)V999
-
PIC 9(3)V999
The value +123.876 has a sign, 3 digits before the decimal, and 3 digits after. PIC S9(3)V999 represents this correctly: S for signed, 9(3) for 3 integer digits, V for implied decimal point, and 999 for 3 fractional digits. Option A uses explicit decimal (.) instead of V, B lacks the sign, and D lacks both the sign and V.
PIC S9(3)V999 is correct. In COBOL, S declares a signed field (needed here because the value is +123.876, i.e., has an explicit sign), 9(3) reserves three digit positions for the integer part (123), and V marks the position of an assumed (non-stored) decimal point, followed by 999 for the three fractional digits (876). COBOL numeric-edited storage fields don't store an actual decimal point character unless explicitly edited with a period, so V is required, not a literal '.'. PIC 9(3).999 and PIC S9(3).999 are wrong because they use a literal period, which isn't valid in a computational PICTURE clause. PIC 9(3)V999 is wrong because it omits the sign (S), losing the '+' representation.