View previous topic :: View next topic
|
Author |
Message |
Gopalakrishnan V
Active User
Joined: 28 Jun 2010 Posts: 102 Location: chennai
|
|
|
|
Since both 9(04) and S9(04) can store upto 4 bytes. Then what is the difference and please explain with an example. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
9(04) value could range from 0 - 9999
S9(04) value could range from -9999 TO +9999 |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Find out from the manuals what S means in a COBOL PICture. Then find out, from the same manuals, how the data is stored and how the values associated with the S are represented.
If still unclear, you provide the examples: what you've done, and what you understood, the input values you used, the output you got, and the output you had expected to get.
I could just give you an answer, but that way you won't actually learn anything. This way you'll pick up lots that you will find invaluable (what does my PICture "look" like in storage?). |
|
Back to top |
|
|
Gopalakrishnan V
Active User
Joined: 28 Jun 2010 Posts: 102 Location: chennai
|
|
|
|
Quote: |
S9(04) value could range from -9999 TO +9999
|
Where the sign byte willl be stored since we have only 4 bytes |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
Gopalakrishnan V wrote: |
Quote: |
S9(04) value could range from -9999 TO +9999
|
Where the sign byte willl be stored since we have only 4 bytes |
There is never a sign byte; depending on the USAGE clause, there may be a sign bit, a sign nybble, or several sign nybbles. RTFM (Principles of Operation is more comprehensive than the Enterprise COBOL reference) to find out which is applicable in your case. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
In a little test program define 2 variables with both PICtures.
Initialize them with a value of 1234.
Multiply one of them by -1
DISPLAY both fields.
Look a these fields in hex and notice the difference.
If you still have doubts, post your hex values and someone here will be able to exdplain. |
|
Back to top |
|
|
|