Interview Questions

What is COMP SYNC?

COBOL Interview Questions


(Continued from previous question...)

What is COMP SYNC?

Causes the item to be aligned on natural boundaries. Can be SYNCHRONIZED LEFT or RIGHT.
For binary data items, the address resolution is faster if they are located at word boundaries in the memory. For example, on main frame the memory word size is 4 bytes. This means that each word will start from an address divisible by 4. If my first variable is x(3) and next one is S9(4) COMP, then if you do not specify the SYNC clause, S9(4) COMP will start from byte 3 ( assuming that it starts from 0). If you specify SYNC, then the binary data item will start from address 4. You might see some wastage of memory, but the access to this computational field is faster.

(Continued on next question...)

Other Interview Questions