Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Why we will use comp-3 declaration

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
jeelagahema

New User


Joined: 12 Jun 2005
Posts: 12
Location: bangalore

PostPosted: Tue Feb 28, 2006 9:55 am    Post subject: Why we will use comp-3 declaration
Reply with quote

why we will use comp-3 declaration?
Back to top
View user's profile Send private message

jsk

New User


Joined: 20 Feb 2006
Posts: 12

PostPosted: Tue Feb 28, 2006 10:10 am    Post subject:
Reply with quote

Hi Jeelagahema,

COMP-3 enables the computer to store two digits in each storage position, except for the rightmost position, which holds the sign. Suppose if you move 1234567 into a field defined 9(7). In DISPLAY mode, which is default, this field will use 7 storage positions.
If you define the field with PIC 9(7) COMP-3, it will however use only four positions

12 34 56 7+

We can save a significant amount of storage by using the USAGE-COMP-3


Please correct me if I am wrong
Back to top
View user's profile Send private message
raghunathns

Active User


Joined: 08 Dec 2005
Posts: 127
Location: rochester

PostPosted: Tue Feb 28, 2006 7:09 pm    Post subject: file having no records what will happen?
Reply with quote

you have to check the file status after each read

end of file.. do not process.. terminate program.
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Wed Mar 01, 2006 12:50 am    Post subject: Re: Why we will use comp-3 declaration
Reply with quote

jeelagahema,

Quote:
why we will use comp-3 declaration?


Just a subscript to what jsk posted. Along with the space savings that is present with COMP-3, it is also easier to read on a program dump than COMP or display, and it is more efficient for the processor than display. If you look at the object code produced by a arithmetic operation, you will fine that the complier converts display fields to COMP-3, does the operation and then converts back to display back to display. The hardware is designed to do the arithmetic operations with COMP-3 or COMP (binary), but not display fields.

Dave
Back to top
View user's profile Send private message
hncs

New User


Joined: 01 Mar 2006
Posts: 11

PostPosted: Thu Mar 02, 2006 4:35 pm    Post subject: COMP-3
Reply with quote

IF WE USE COMP-3 THEN THE EFFICIENCY IS MORE. AND MORE OVER IT WILL TAKE VERY LESS MEMORY COMPARED WITH DISPLAY.

COMP-3 IS NOTHING BUT PACKED DECIMAL VALUE.

SUPPOSE IF THE FIELD SIZE IS S9(N)

IF N IS EVEN THEN IT WILL TAKE (N+2)/2 BYTES.

IF N IS ODD THEN IT WILL TAKE (N+1)/2 BYTES.

FOR EACH DIGIT IT WILL TAKE HALF BYTE AND HALF BYTE FOR SIGN.
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm
No new posts Need help to populate date in COMP-3 ... chetanambi DFSORT/ICETOOL 3 Tue Jun 21, 2016 12:25 pm
No new posts comparing comp-3 and unpacked numbers juares castro COBOL Programming 3 Mon May 30, 2016 6:46 pm
No new posts SIGNED DECIMAL TO COMP-3 using cobol ... ram_vizag COBOL Programming 1 Tue Mar 01, 2016 11:32 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us