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

Differnce between comp1 and comp3


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
MikePradeep

New User


Joined: 05 Jan 2007
Posts: 5
Location: Bangalore

PostPosted: Mon Jan 22, 2007 7:18 pm
Reply with quote

Can anyone tell me how comp-1 and comp-3 variables are used and stored , with some examples?
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Mon Jan 22, 2007 9:47 pm
Reply with quote

Try looking first, for instance:
http://www.ibmmainframes.com/viewtopic.php?t=393
and:
http://www.ibmmainframes.com/viewtopic.php?t=11256
Back to top
View user's profile Send private message
sachin_star3
Warnings : 1

New User


Joined: 30 Sep 2006
Posts: 78
Location: pune

PostPosted: Tue Jan 23, 2007 10:12 pm
Reply with quote

COMP-1 :- IS BINARY FORMAT IS USED WHEN YOUR FIELD IS IN NUMERIC BUT NOT ANY DECIMAL POINT
STORING METHODE:- 0 TO 4 REQUIRES 2 BYTE
I.E PIC(9999) - 2BYTES
5 TO 9 REQUIRES 4 BYTE
10 TO 18 REQUIRES 8 BYTE
COMP-3 : IS CALLED PACKED DECIMAL: IS USED WHEN YOUR FIELD IS NUMERICS WITH DECIMAL POINTS
STORING METODE ARE-
FOR ODD-->(N/2)+0.5=STORAGE FIELD(BYTE)

FOR EVEN-->(N/2)+1= STORAGE FIELD(BYTE)

FOR EXAMPLE PIC(999) USAGE COMP-3 CONTAINS ODD SO BY ABOVE CALSULATION IT REQUIRES FIELD (3/2)+0.5=2BYTE

BASICALLY COMP IS USED FOR NUMERIS FIELD FOR FASTER CALUCALATION AND USAGE DISPLAY(DEFAULT) IS USED FOR ALPHANUMERIC AND ALPHABETIC CHARACTER FOR FASTER ACCESS

I THINK THIS WILL HELP YOU
FROM-SACHIN BORASE
PUNE
Back to top
View user's profile Send private message
shashirbsk

New User


Joined: 18 Jan 2007
Posts: 7
Location: hyderabad

PostPosted: Tue Jan 30, 2007 5:09 pm
Reply with quote

As per my knowledge the explanation given for COMP-1 is for Binary, COMP and COMP-4 data items.
COMP-1 is specified for internal floating-point items (single precision) and is of 4 bytes long. COMP-1 cannot have a PIC clause.

Please correct me if I am wrong.
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 -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Select two different counts from SQL... DB2 6
No new posts Move from Comp3 variable to Edited Va... COBOL Programming 7
No new posts Move from Comp3 variable to Edited Va... COBOL Programming 8
No new posts Conversion of negative amount (comp3)... COBOL Programming 9
No new posts Changing the precision of a comp3 field DFSORT/ICETOOL 2
Search our Forums:

Back to Top