Multiple choice technology mainframe

What is the PIC representation for +123.876?

  1. PIC S9(3).999

  2. PIC 9(3).999

  3. PIC S9(3)V999

  4. PIC 9(3)V999

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

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.

AI explanation

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.