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

Display problem with compute


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 2146
Location: At my coffee table

PostPosted: Fri Apr 17, 2009 12:45 am
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Apr 17, 2009 12:49 am
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Apr 17, 2009 12:55 am
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Apr 17, 2009 1:00 am
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: 2501
Location: Atlanta, Georgia, USA

PostPosted: Fri Apr 17, 2009 1:58 am
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: 2146
Location: At my coffee table

PostPosted: Fri Apr 17, 2009 2:04 am
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Apr 17, 2009 3:08 am
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: 3156
Location: Tucson AZ

PostPosted: Fri Apr 17, 2009 5:39 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts z/vm installation problem All Other Mainframe Topics 0
No new posts Job scheduling problem. JCL & VSAM 9
No new posts How to display the leading zeros of a... DB2 7
No new posts Problem with IFTHEN=(WHEN=GROUP,BEGIN... DFSORT/ICETOOL 5
Search our Forums:

Back to Top