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
 

 

Which is suitable: COMP or COMP-3 ?

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

New User


Joined: 26 Aug 2005
Posts: 33
Location: bangalore

PostPosted: Mon Sep 29, 2008 4:31 pm    Post subject: Which is suitable: COMP or COMP-3 ?
Reply with quote

Hi All,
I know COMP is binary representation of data item and COMP-3 is packed decimal representation .. can you please explain me which one will be sutaible for application programming and why ??


Thanks
Mijanurit
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7990
Location: Bellevue, IA

PostPosted: Mon Sep 29, 2008 5:13 pm    Post subject:
Reply with quote

Depending on what you're doing, COMP and COMP-3 are both suitable for application programming. For example, writing programs using CICS pretty much requires COMP fields for some of the commands, especially if you want to see the RESP field. If a file was created using packed fields, you have no choice but to use COMP-3 when reading the file.
Back to top
View user's profile Send private message
hchinnam

New User


Joined: 18 Oct 2006
Posts: 73

PostPosted: Mon Sep 29, 2008 5:26 pm    Post subject:
Reply with quote

Adding to what Robert said,

IF your program has more arithmetic operations then it is better to use COMP.
Back to top
View user's profile Send private message
satishk

New User


Joined: 20 Jul 2007
Posts: 7
Location: Hyderabad

PostPosted: Mon Sep 29, 2008 6:04 pm    Post subject: COMP & COMP-3
Reply with quote

Description as below:
COMPUTATIONAL or COMP Representation of the COMPUTATIONAL phrase is system-dependent and is normally assigned to representations that yield the greatest efficiency when arithmetic operations are performed on that system.
For the VS COBOL II compiler, the COMPUTATIONAL phrase is synonymous with BINARY.

COMPUTATIONAL-3 or COMP-3 (internal decimal)
For VS COBOL II, this is the equivalent of PACKED-DECIMAL.

The amount of storage occupied by a binary item depends on the number
of decimal digits defined in its PICTURE clause:

Digits in PICTURE Clause Storage Occupied
1 through 4 2 bytes (halfword)
5 through 9 4 bytes (fullword)
10 through 18 8 bytes (doubleword) ¦
The leftmost bit of the storage area is the operational sign.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon Sep 29, 2008 6:55 pm    Post subject:
Reply with quote

This is already discussed many times

You will find many topics on comp comp-3 and its use if you search on forum. Here is one

Click here it may help you
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
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us