What is the difference between Comp-5 and Comp in Cobol ??

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
nrajini
Member
Posts: 23
Joined: Sun Oct 05, 2008 4:35 pm

What is the difference between Comp-5 and Comp in Cobol ??

Post by nrajini » Mon Oct 06, 2008 2:16 pm

What is the difference between Comp-5 and Comp in Cobol ??

User avatar
Krishna
Site Admin
Posts: 1052
Joined: Fri Jan 27, 2006 7:50 am

Post by Krishna » Mon Oct 06, 2008 4:42 pm

COMP
------
COMP half word 1 to 4 = 2 Bytes,
5 to 9= 4 Bytes
10 to 18 = 8 bytes

COMP-5
---------
Data items that you declare as USAGE COMP-5 are represented in storage as
binary data. However, unlike USAGE COMP items, they can contain values of
up to the capacity of the native binary representation (2, 4, or 8 bytes) rather than being limited to the value implied by the number of 9s in the PICTURE clause. When you move or store numeric data into a COMP-5 item, truncation occurs at the binary field size rather than at the COBOL PICTURE size limit. When you reference a COMP-5 item, the full binary field size is used in the operation.

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