Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How binary is stored as COMP variable

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> HomeWorks & Requests
View previous topic :: :: View next topic  
Author Message
rohin

New User


Joined: 29 Apr 2005
Posts: 21
Location: Gurgaon, India

PostPosted: Thu Jun 07, 2007 3:20 pm    Post subject: How binary is stored as COMP variable
Reply with quote

Hi,

I didnot understand how binary is stored as COMP variable?
S9(4) COMP is stored in 2 bytes.
How is value 32768 or -32767 stored as COMP, as in how will it look like if I turn HEX ON?

THanks
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Thu Jun 07, 2007 3:47 pm    Post subject:
Reply with quote

Actually +32768 is one too big to fit and -32767 is one less than the negitive max. the real limits are -32768 through +32767 which would be:
..
80
00
through
..
7F
FF
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 962
Location: Richmond, Virginia

PostPosted: Thu Jun 07, 2007 5:55 pm    Post subject:
Reply with quote

COBOL won't let you store anything bigger than +/- 9999 in an S9(4) COMP, as the replication numver = 4. (Although some 5-digit numbers can be stored in a halfword (2 bytes), not all can.)

You need S9(5) COMP thru S9(9) COMP, which allocates a fullword (4 bytes), and can store the max number of digits you specify.
Back to top
View user's profile Send private message
prasadvrk

Active User


Joined: 31 May 2006
Posts: 200
Location: Netherlands

PostPosted: Fri Jun 08, 2007 4:42 pm    Post subject:
Reply with quote

I think the following link will not be amiss here http://ibmmainframes.com/viewtopic.php?t=19569&highlight=comp5

S9(04) COMP-5 can accomodate five digit data as opposed to S9(04)COMP
Pray be careful in using COMP-5 as it has some machine dependency.
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 -> HomeWorks & Requests All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts resume binary ftp in z/os meykh2014 All Other Mainframe Topics 6 Sun Jan 22, 2017 10:01 am
No new posts Is the 'prompt' data for the DSLIST p... Willy Jensen TSO/ISPF 2 Tue Dec 06, 2016 4:38 am
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts Access SQLCA fields inside a stored p... gangapd DB2 4 Thu Oct 27, 2016 10:20 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
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us