Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Differnce between comp1 and comp3

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
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    Post subject: Differnce between comp1 and comp3
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: 3158
Location: Tucson AZ

PostPosted: Mon Jan 22, 2007 9:47 pm    Post subject:
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Conversion of negative amount (comp3)... dharmaraok COBOL Programming 9 Mon Feb 24, 2014 5:27 pm
No new posts Changing the precision of a comp3 field razesh84 DFSORT/ICETOOL 2 Tue Jan 08, 2013 3:06 pm
No new posts How to convert Numeric to Packed Deci... jackie.jay CLIST & REXX 8 Mon Oct 29, 2012 5:37 pm
No new posts Moving group varibale to COMP3 variable lakshmankumar COBOL Programming 3 Thu Jul 14, 2011 4:28 pm
No new posts Comp3 Move job1919 COBOL Programming 7 Thu Nov 11, 2010 6:53 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us