What are the type of comp usage?

Editorial / Best Answer

Answered by: Gayathri

  • Sep 4th, 2005


COMP Usage is used for data items of numeric type. There are 4 types of COMP usage. 
1.COMP : Used only for integers.Either half word or full word . 
2.COMP -1 :Used for floating points.Internal representation is hexa decimal.full word is used.No PIC Clause . 
3.COMP -2 : Similar to COMP-1.Only difference is double word(8 bytes )is used 
4.COMP -3 :Interenal representation is decimal.Each character is assinged to half byte.The sign bit is assinged to right most bit. The no.of bytes required for n characters is (n/2) + 1 (rounding down)

Showing Answers 1 - 5 of 5 Answers

Gayathri

  • Sep 4th, 2005
 

COMP Usage is used for data items of numeric type. There are 4 types of COMP usage. 
1.COMP : Used only for integers.Either half word or full word . 
2.COMP -1 :Used for floating points.Internal representation is hexa decimal.full word is used.No PIC Clause . 
3.COMP -2 : Similar to COMP-1.Only difference is double word(8 bytes )is used 
4.COMP -3 :Interenal representation is decimal.Each character is assinged to half byte.The sign bit is assinged to right most bit. The no.of bytes required for n characters is (n/2) + 1 (rounding down)

V

  • Dec 13th, 2006
 

COMP - Half word - s9(01) to s9(04) takes 2 bytes for storage

Full Word - S9(05) to S9(08)  takes 4 bytes of storage

Double word S9(09) - s9(18) takes 8 bytes.

comp usage are

1 comp1
2 comp2
3 comp
4 comp3

but comp usage can reserve max. 8 bytes for internal representation of variable like


pic 9(1) to 9(4) reserve 2 bytes (half word)
pic 9(5) to 9(9) reserve 4 bytes (full word)
pic 9(10) to 9(18) reserve 8 bytes (double word)

  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