Multiple choice technology programming languages

How many bytes does a S9(7) COMP-3 field occupy ?

  1. 3

  2. 4

  3. 8

  4. 10

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

COMP-3 (packed decimal) stores 2 digits per byte plus 1/2 byte for the sign. S9(7) means 7 digits plus 1 sign = 8 nybbles. 8 divided by 2 equals 4 bytes. Formula: (digits + 1) / 2 = bytes, rounding up if needed. So (7+1)/2 = 4 bytes.