How data names with comp1 usage is stored in memory ? What is difference between comp1 comp2 , comp3 and binary ?

Showing Answers 1 - 12 of 12 Answers

sangramkc

  • Nov 29th, 2006
 

COMP-1 is usually a single precision floating point value , stored in 4 bytes.

COMP-2 is usually a double precision floating point value , stored in 8 bytes

COMP-3 stores data in BCD format Binary Coded Decimal format with sign after least significat digit

Thanks,

Sangram

Sai ram

karthi

  • Dec 7th, 2006
 

hi,

Comp - 1: Its single pricison floting point value. This is occupies for 4 bytes.

Comp - 2: Its Double pricison floting point value. This is occupies for 8 bytes.

Comp - 3: Its Packed Decimal value. Each digit contains half byte + half sign  byte. but the sign stored in last nibble.  formula of comp - 3: n/2 + 0.5

  Was this answer useful?  Yes

USAGE COMP-1 : Data is stored as single precision floating point in 4 bytes.Difference between COMP-1, COMP-2, COMP-3 and COMP :COMP-1 data is stored as single precision floating point using 4 bytes of memory.COMP-2 data is stored as double-precision floating point using 8 bytes of memory.COMP-3 data is stored in Packed Decimal format. The number of bytes occupied depends on the size of the field specified in the PICTURE clause.The formula for finding the number of bytes needed to store the data is INTEGER((n/2) + 1) where 'n' is the size of the field. (Note: If SIGN SEPARATE clause is specified, one more byte is needed to store the sign).COMP : data is stored in binary format.For USAGE COMP-1 or USAGE COMP-2 picture clause is not to be given whereas for COMP and COMP-3 picture clause is to be given.

ramana

  • Feb 7th, 2007
 

Hello Guys,

Comp-1: Storage is in hexadecimal and size is full word(4-bytes)
Comp-2: Storage is in hexadecimal and size is duobleword.
Comp-3: Storage is in packed hexadecimal and size is (n/2)+1.

  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