What is difference between comp & comp-4?

Showing Answers 1 - 9 of 9 Answers


  • Sep 14th, 2005

Comp refers to binary representation which occupies half word(16bits) or full word(32bits) and Comp-3 refers to packed decimal representation  where one digit occupies half a byte ie, a nibble and the sign is stored as the rightmost half -a -byte. C or F represents the positive sign and D represents the negative sigh in hexadecimal format.

  Was this answer useful?  Yes


  • Nov 4th, 2005

hai lavanya u have written only for the comp, comp3.it is ok but what is the comp4

  Was this answer useful?  Yes

Dipu Narayanan

  • Jan 12th, 2006

comp is :- 1 TO 4 = 2 BYTES,5 TO 9 = 4 BYTES,10 TO 18 = 8 BYTES.

 comp-4 :- maximum limit is 9(18) and it is taking according to the   

                pic Clause.

send me back if you have any questions regarding about that or i am



  • Jan 24th, 2006

What is the reason for max limit of S9 of 18 for Comp.

  Was this answer useful?  Yes


  • Feb 22nd, 2006

there is no difference b/w COMP and COMP-4 . they are synonymous to binary integer.

  Was this answer useful?  Yes

M Hussain

  • Apr 11th, 2007

In COBOL There is no usage clause like comp-4

  Was this answer useful?  Yes


  • Nov 16th, 2007

For all of you out who have not heard about comp-4. Wake up. Comp-4 does exist and it is just like comp - ie. it is a half-word (2 bytes).

This might help those of you who are confused about comp fields:

COMP     half word           1 to 4 = 2bytes, 5 to 9= 4 bytes 10 to 18 = 8 bytes
COMP-1  single word       4 bytes
COMP-2  double word      8 bytes
COMP-3  (use  n/2 +1) where n=length of field
COMP-4  half word          same as COMP                   

  Was this answer useful?  Yes


  • Dec 13th, 2011

Not always correct. In our computer Comp = Comp-3.
So always check the manual of the compiler.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.


Related Answered Questions


Related Open Questions