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
 
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: 8281
Location: Dubuque, Iowa, USA

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 COMP Variables Mismatch gayu7 COBOL Programming 5 Wed Dec 20, 2017 5:06 pm
No new posts Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm
No new posts CONDITIONAL USING COMP-2 WITH PROBLEMS. JOSUEGENTIL COBOL Programming 7 Wed Nov 08, 2017 11:13 pm
No new posts how can i move s9(9) to s9(9) usage comp HARENDRA CHOUDHARY COBOL Programming 3 Mon Nov 06, 2017 12:10 am
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm

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