Page 1 of 1
doubt - COMP in COBOL
Posted: Tue Oct 21, 2008 4:25 pm
Can anyone clearly explain the comp in Cobol language?
Posted: Tue Oct 21, 2008 4:54 pm
Data item defined with COMP is represented in pure binary.
As a programmer, we need to know following.
9(1) COMP to 9(4) COMP => Occupies 2 bytes of storage
9(5) COMP to 9(9) COMP => Occupies 4 bytes of storage
9(10) COMP to 9(18 ) COMP => Occupies 8 bytes of storage.
COMP data item should not contain any character other than 9,S
Let me know, if you need any other details.
COMP VS COMP-3
Posted: Wed Oct 22, 2008 1:18 pm
More info on COMP in COBOL.
comparison between COMP and COMP-3
- Binary format might not be suited for decimal alignment as packed
- Binary format is not converted to and from DISPLAY format as easily as
packed decimal format.
Posted: Sat Nov 22, 2008 9:28 am
Comp (with no suffix) leaves the choice of the data type to the compiler writer. The intent of this data type is to make it the most efficient format on any given machine, which is usually some binary format. Because of this, comp varies greatly between platforms, more than most other types.