IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

About comp, comp2, comp1, comp3, comp4


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
trendz

New User


Joined: 12 Aug 2003
Posts: 2

PostPosted: Fri Sep 05, 2003 1:31 pm
Reply with quote

where should we use these these comps
for what purpose we use comps
Back to top
View user's profile Send private message
mcmillan

Site Admin


Joined: 18 May 2003
Posts: 1210
Location: India

PostPosted: Sat Sep 06, 2003 1:33 pm
Reply with quote

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
View user's profile Send private message
DNelsonPNC

EXPERT


Joined: 15 Jun 2003
Posts: 10
Location: North Carolina

PostPosted: Fri Oct 17, 2003 5:33 am
Reply with quote

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
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Wed Nov 23, 2005 10:24 am
Reply with quote

hi frnd,

check this link for more about COMP

www.discinterchange.com/TechTalk_COBOL_comp_.html
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
No new posts Interviewers are surprised with my an... Mainframe Interview Questions 6
No new posts Cobol COMP-2 fields getting scrambled... Java & MQSeries 6
No new posts convert alphanumeric PIC X(02) to hex... COBOL Programming 3
Search our Forums:

Back to Top