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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm
No new posts Query on DB2 WLM stored procedures ashek15 DB2 8 Sun Feb 12, 2017 11:13 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us