Multiple choice technology mainframe

WS-XYZ PIC S9(5) USAGE COMP-3. How many bytes will this occupy?

  1. 2

  2. 3

  3. 4

  4. 5

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

COMP-3 (PACKED-DECIMAL) in COBOL stores digits in packed format where each digit (except the rightmost) occupies 4 bits (1 nibble). PIC S9(5) means 5 digits packed: digits 1-4 use 4 nibbles (2 bytes), digit 5 + sign uses 1 nibble, totaling 5 nibbles which rounds up to 3 bytes (1 byte = 2 nibbles, so 5 nibbles requires 3 bytes). The formula is: (n/2) + 1 bytes where n is number of digits.