Can we declare a variable with PIC S9(9)V9(9)?.How many bytes will it occupy?
-
No .It occupies 20 bytes
-
No.It occupies 19 bytes
-
Yes.It occupies 18 bytes.
-
None of these
In COBOL, PIC S9(9)V9(9) declares a signed numeric variable with 9 digits before and 9 digits after the decimal point. This occupies 18 bytes in display format (each digit requires one byte, plus one for sign, and V is implicit decimal). The V indicates an implied decimal point position and doesn't occupy storage.
Yes, PIC S9(9)V9(9) is a valid COBOL numeric field: S for sign, 9(9) for 9 integer digits, V for an implied (non-stored) decimal point, and 9(9) for 9 decimal digits — 18 total digits. With the default USAGE (DISPLAY/zoned decimal) and no explicit sign clause, each digit occupies one byte and the sign is typically overpunched onto the last digit's byte rather than taking a separate byte, so the field occupies 18 bytes total (not 19 or 20). This matches standard COBOL zoned-decimal storage rules, making 'Yes, 18 bytes' the correct answer.