Interview Questions

Why do we code S9(4) COMP? In spite of knowing COMP-3 will occupy less space?

COBOL Interview Questions


(Continued from previous question...)

Why do we code S9(4) COMP? In spite of knowing COMP-3 will occupy less space?

Here S9(4) COMP is small integer, so two words equal to 1 byte so totally it will occupy 2 bytes ( 4 words ). here in S9(4) COMP-3 as one word is equal to 1/2 byte, 4 words equal to 2 bytes and sign will occupy 1/2 byte so totally it will occupy 3 bytes.

(Continued on next question...)

Other Interview Questions