# What is difference between comp & comp-4?

#### Lavanya

• 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.

#### suresh

• Nov 4th, 2005

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

#### 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

wrong

#### John

• Jan 24th, 2006

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

#### suraj

• Feb 22nd, 2006

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

#### Senijor Mastrojani Profile Answers by Senijor Mastrojani

• Oct 24th, 2006

john,

it's only to use a larger value...

#### M Hussain

• Apr 11th, 2007

In COBOL There is no usage clause like comp-4

#### Kamal

• 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

#### ansgar Profile Answers by ansgar

• Dec 13th, 2011

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