difference between COMP and COMP-3

This is a Mainframe COBOL forum - you can post your queries on Mainframe COBOL, VS COBOL II, COBOL/370 , Enterprise COBOL

Moderators: dbzTHEdinosauer, Moderator Group

Post Reply
pkaushi
Member
Posts: 9
Joined: Mon Feb 06, 2006 1:45 pm

difference between COMP and COMP-3

Post by pkaushi » Wed Feb 08, 2006 10:53 am

Hi,

I would like to know the situation of when do we use a COMP and when COMP3. I know that COMP stores binary data and COMP-3 packed decimal. But what actually are the scenarios where we uese the two??
Thanks and Regards,
Prashant

User avatar
prasad
Member
Posts: 7
Joined: Mon Feb 06, 2006 12:04 am

Usage of COMP and COMP-3 values

Post by prasad » Thu Feb 09, 2006 8:33 am

Hi pkaushi,


It depends how it's being used.

My recommendation is, if you're doing arithmetic then use COMP-3.
If you're not using Indexes and you're subscripting into an array then use COMP (as recommended by IBM).

More details about COMP & COMP-3 are below.

COMP
-------
To produce the most efficient code for a BINARY data item, ensure that it has:
. A sign (an S in its PICTURE clause)
. Eight or fewer digits
TRUNC(STD) / TRUNC(BIN) / TRUNC(OPT) compiler options will change the performance of the comp significantly.


COMP-3
---------
To produce the most efficient code for a PACKED-DECIMAL data item, ensure that it has:
. A sign (an S in its PICTURE clause)
. An odd number of digits (9s in the PICTURE clause), so that it occupies an exact number of bytes without a half byte left over
. 15 or fewer digits in the PICTURE specification to avoid using library routines for multiplication and division



Thanks,
Prasad

ravi
Member
Posts: 1
Joined: Mon Aug 14, 2006 4:20 pm

file

Post by ravi » Mon Aug 14, 2006 4:22 pm

what is a index file ? how to handle it

academyindia4

Topic deleted by Admin

Post by academyindia4 » Wed Jan 27, 2016 8:09 pm

<< Content deleted By Admin >>

academyindia4

Topic deleted by Admin

Post by academyindia4 » Mon Feb 01, 2016 10:49 pm

<< Content deleted By Admin >>

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others