View previous topic :: View next topic
|
Author |
Message |
trendz
New User
Joined: 12 Aug 2003 Posts: 2
|
|
|
|
where should we use these these comps
for what purpose we use comps |
|
Back to top |
|
|
mcmillan
Site Admin
Joined: 18 May 2003 Posts: 1210 Location: India
|
|
|
|
Dear,
You can use comp variables:
1. For effective arithmatic calculations
2. For saving memory/register area
3. For faster program execution time
Some applications of comp items are
1. Counters
2. Incrementers
3. Loop variables
3. System internal data
Use COMP-1 FOR FLOATING POINT data when digits<= 8
Use COM-2 for higher floating points
Use COMP-3 for decimal data.
Refer ibmmainframes.com/size.html for more info. |
|
Back to top |
|
|
DNelsonPNC
EXPERT
Joined: 15 Jun 2003 Posts: 10 Location: North Carolina
|
|
|
|
COMP is binary integer data, 9(4) is 2 byte integer (-32768 - +32767)
9(9) is full word (4 byte integer); 9(18) is double word (8 byte integer)
Less than the number of digits per size are rounded up by the compiler to the next higher (i.e 9(2) is same as 9(4); 9(5) is same as 9(9); 9(10) is same as 9(18).
This a part of the COBOL standard and does not vary by platform. The way the data is stored may vary by platform (i.e. Mainframe does not store binary the same way a PC stores binary.)
This is also explained in detail in the language reference manuals. |
|
Back to top |
|
|
khamarutheen
Active Member
Joined: 23 Aug 2005 Posts: 677 Location: NJ
|
|
Back to top |
|
|
|