Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
Difference between comp4 and comp5

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe COBOL
Author Message
amr
Warnings : 1

New User


Joined: 04 Aug 2005
Posts: 2

PostPosted: Thu Aug 04, 2005 5:11 pm    Post subject: Difference between comp4 and comp5
Reply with quote

what is difference between comp4 and comp5 ?
Back to top
View user's profile Send private message
References
shivashunmugam Muthu

Active User


Joined: 22 Jul 2005
Posts: 114
Location: Chennai

PostPosted: Thu Aug 04, 2005 5:19 pm    Post subject: Re: cobol
Reply with quote

COMP-4 is similar to Binary & COMP

COMP-5 is for display usage type.. termed as native binary

for more explanation refer COBOL lang reference
Back to top
View user's profile Send private message
priyesh.agrawal

Global Moderator


Joined: 28 Mar 2005
Posts: 1509
Location: Chicago, IL

PostPosted: Thu Aug 04, 2005 5:52 pm    Post subject: Re: cobol
Reply with quote

Check out this earlier post....It gives a good description about them.....

http://ibmmainframes.com/viewtopic.php?t=146

Regards,

Priyesh.
Back to top
View user's profile Send private message
thanooz

Active User


Joined: 28 Jun 2005
Posts: 105

PostPosted: Thu Aug 04, 2005 9:08 pm    Post subject:
Reply with quote

hi amr


comp4 is just like as binary or comp

01 x pic 9(4) comp.

in above example it takes 2 bytes.

01 x pic 9(5) comp5.

in this example also it takes 4 bytes . it is not depend on legth specified in cobol.It will consontrate on value wich you stored in this field.

Table 5. Ranges in value of COMP-5 data items
PICTURE Storage representation Numeric values
S9(1) through S9(4) Binary halfword (2 bytes) -32768 through +32767
S9(5) through S9(9) Binary fullword (4 bytes) -2,147,483,648 through
+2,147,483,647
S9(10) through S9(18)Binary doubleword (8 bytes)
-9,223,372,036,854,775,808 through +9,223,372,036,854,775,807

9(1) through 9(4) Binary halfword (2 bytes) 0 through 65535
9(5) through 9(9) Binary fullword (4 bytes) 0 through 4,294,967,295
9(10) through 9(18) Binary doubleword (8 bytes)
0 through 18,446,744,073,709,551,615


thanks,
thanooz.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe COBOL All times are GMT + 6 Hours
Page 1 of 1