View previous topic :: View next topic
|
Author |
Message |
rohin
New User
Joined: 29 Apr 2005 Posts: 21 Location: Gurgaon, India
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
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 |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1050 Location: Richmond, Virginia
|
|
|
|
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 |
|
|
prasadvrk
Active User
Joined: 31 May 2006 Posts: 200 Location: Netherlands
|
|
Back to top |
|
|
|