Where will be the sign stored in COMP field?
-
How can u store a sign in COMP?huh!
-
You can store sign only in COMP-3
-
Most significant bit
-
Most significant byte
In COMP (binary computational) format, the sign is stored in the most significant bit (MSB) of the binary representation. A value of 0 in the MSB indicates a positive number, while 1 indicates negative. This differs from COMP-3 (packed decimal) where the sign uses a separate nibble in the last byte.
In a COBOL COMP (binary) field, the sign of the value is stored in the most significant bit of the binary representation (0 for positive, 1 for negative) — this is standard two's-complement-style binary signed representation used by mainframe COMP fields. This differs from COMP-3 (packed decimal), where the sign is instead stored as a half-byte (nibble) in the rightmost position of the field. 'Most significant byte' is imprecise/wrong since it's specifically the sign bit, not a whole byte, that carries the sign in COMP.