IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

What is the difference between 9(04) and S9(04) ?


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Gopalakrishnan V

Active User


Joined: 28 Jun 2010
Posts: 102
Location: chennai

PostPosted: Wed Jul 03, 2013 12:44 pm
Reply with quote

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
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1586
Location: Andromeda Galaxy

PostPosted: Wed Jul 03, 2013 12:55 pm
Reply with quote

9(04) value could range from 0 - 9999
S9(04) value could range from -9999 TO +9999
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7310
Location: Inside the Matrix

PostPosted: Wed Jul 03, 2013 12:56 pm
Reply with quote

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
View user's profile Send private message
Gopalakrishnan V

Active User


Joined: 28 Jun 2010
Posts: 102
Location: chennai

PostPosted: Wed Jul 03, 2013 12:57 pm
Reply with quote

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
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Wed Jul 03, 2013 3:04 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19245
Location: Inside the Matrix

PostPosted: Wed Jul 03, 2013 8:48 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Difference between CEE3250C and CEE3204S COBOL Programming 2
No new posts Difference between sysexec and sysproc CLIST & REXX 6
No new posts Difference between DATACLAS=MULTIVOL ... JCL & VSAM 10
No new posts Difference between CICS region bounce... CICS 3
No new posts Difference between GE and GB return c... IMS DB/DC 8
Search our Forums:

Back to Top