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
 

 

Display problem with compute

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
dilpreet

New User


Joined: 18 Mar 2008
Posts: 34
Location: INDIA

PostPosted: Fri Apr 17, 2009 12:35 am    Post subject: Display problem with compute
Reply with quote

what will be displayed if

variable X initialized to spaces
compute X = X+1
Display X
Back to top
View user's profile Send private message

CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Fri Apr 17, 2009 12:45 am    Post subject:
Reply with quote

I'd guess that if X had an unsigned pic of numeric display, "1" would be the answer.
If it were signed, I'd think that you'd get a data exception.
Just a guess......
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Apr 17, 2009 12:48 am    Post subject:
Reply with quote

Why dont you try it?

Expain what is your "display problem" .
Do not ask output of your code to people...
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8118
Location: East Dubuque, Illinois, USA

PostPosted: Fri Apr 17, 2009 12:49 am    Post subject:
Reply with quote

What result do you get? Does it depend on the definition of X?
Back to top
View user's profile Send private message
dilpreet

New User


Joined: 18 Mar 2008
Posts: 34
Location: INDIA

PostPosted: Fri Apr 17, 2009 12:52 am    Post subject:
Reply with quote

Just wanted to know that what wud be displayed if such condition happens

Will it abend or display 1
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8118
Location: East Dubuque, Illinois, USA

PostPosted: Fri Apr 17, 2009 12:55 am    Post subject:
Reply with quote

Good guessing, CICS Guy, I'm with you on that ... COMP data field value would depend on half word, whole word, double word.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8118
Location: East Dubuque, Illinois, USA

PostPosted: Fri Apr 17, 2009 1:00 am    Post subject:
Reply with quote

dilpreet: your problem is poorly stated. X can be signed or unsigned, USAGE DISPLAY, USAGE COMP, USAGE COMP-3, or even COMP-1 / COMP-2. Results, as we've clearly indicated, will vary depending on which way(s) X is defined. 1 is a possible answer. 16449 is a possible answer. S0C7 abend is a possible answer. 1077952577 is a possible answer. There are others possible. State your problem better, get better answers.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Fri Apr 17, 2009 1:58 am    Post subject: Reply to: Display problem with compute
Reply with quote

Unless the compiler issues an OI X'0F' against the SPACE after it's been packed, the sign-bit will be invalid (B'0100') and the subsequent AP instruction will fail with a S0C7.

Just my .02 cents....

Regards,
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Fri Apr 17, 2009 2:04 am    Post subject: Re: Reply to: Display problem with compute
Reply with quote

Bill O'Boyle wrote:
Unless the compiler issues an OI X'0F' against the SPACE after it's been packed, the sign-bit will be invalid (B'0100') and the subsequent AP instruction will fail with a S0C7.
Exactly what I was thinking..... icon_smile.gif
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8118
Location: East Dubuque, Illinois, USA

PostPosted: Fri Apr 17, 2009 3:08 am    Post subject:
Reply with quote

Bill, if the field is packed or signed USAGE DISPLAY yes you get a S0C7 abend. If, however, the field is unsigned USAGE DISPLAY the result is a 1.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Apr 17, 2009 5:39 am    Post subject:
Reply with quote

Robert Sample wrote:
Bill, if the field is packed or signed USAGE DISPLAY yes you get a S0C7 abend. If, however, the field is unsigned USAGE DISPLAY the result is a 1.
Exactly what I was thinking..... icon_smile.gif , thanks for the update...

Bill, just the CICS Guy......
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Display upon console bipinpeter COBOL Programming 1 Thu Jun 22, 2017 12:35 am
No new posts Strings with double quotes having pro... raja Arumugam All Other Mainframe Topics 11 Thu Mar 30, 2017 10:34 am
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Problem reading GTF trace output danik56 ABENDS & Debugging 7 Thu Mar 16, 2017 1:02 pm
No new posts Display FTP Session Count within TSO Yolanda Harvey TSO/ISPF 3 Fri Mar 10, 2017 10:31 pm


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