Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 968
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 COMP Variables Mismatch gayu7 COBOL Programming 5 Wed Dec 20, 2017 5:06 pm
No new posts CICS web service from DB2 Triggers or... kiranprasad DB2 1 Wed Dec 20, 2017 11:10 am
No new posts Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm
No new posts CONDITIONAL USING COMP-2 WITH PROBLEMS. JOSUEGENTIL COBOL Programming 7 Wed Nov 08, 2017 11:13 pm
No new posts how can i move s9(9) to s9(9) usage comp HARENDRA CHOUDHARY COBOL Programming 3 Mon Nov 06, 2017 12:10 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us