IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Difference between comp 4 and comp 5


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
amr
Warnings : 1

New User


Joined: 04 Aug 2005
Posts: 2

PostPosted: Thu Aug 04, 2005 5:11 pm
Reply with quote

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

Active User


Joined: 22 Jul 2005
Posts: 114
Location: Chennai

PostPosted: Thu Aug 04, 2005 5:19 pm
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

Senior Member


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

PostPosted: Thu Aug 04, 2005 5:52 pm
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

New User


Joined: 28 Jun 2005
Posts: 99

PostPosted: Thu Aug 04, 2005 9:08 pm
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
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Timestamp difference and its average ... DB2 11
No new posts Difference when accessing dataset in ... JCL & VSAM 7
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
No new posts Interviewers are surprised with my an... Mainframe Interview Questions 6
Search our Forums:

Back to Top