Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
Comp-3 to hold negative Zero
Goto page Previous  1, 2
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe COBOL
Author Message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 998
Location: At my desk

PostPosted: Fri May 09, 2008 5:11 pm    Post subject:
Reply with quote

birdy K wrote:
Code:
01 fval pic x(06) value '00000}'
01 tsval redefines fval.
     05 sval pic s9(06).
01 tval pic s9(05) comp-3.

move fval to tsval. Now sval value is -000000. But while moving from sval to tval. It is showing as +00000. I am seeing this values in xpeditor.
Because the COBOL compiler is insuring that the sign is correct and prevents the negetive value for zero.
Try
Code:
01 fval pic x(03) value X'00000}'
01 tval pic s9(05) comp-3.
01 sval refefines tval pic x(3).
When you move fval to sval, tval will be a -0.....
Back to top
View user's profile Send private message
References
PostPosted: Fri May 09, 2008 5:11 pm    Post subject: Re: Reply with quote

birdy K

New User


Joined: 05 Mar 2008
Posts: 14
Location: chennai

PostPosted: Fri May 09, 2008 5:12 pm    Post subject:
Reply with quote

Thank u for all. My onsite told now not to include -. Anyway if anyone knows Please suggest.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 998
Location: At my desk

PostPosted: Fri May 09, 2008 5:19 pm    Post subject:
Reply with quote

birdy K wrote:
My onsite told now not to include -. Anyway if anyone knows Please suggest.
Huh?
Not include the minus on the zero?
If anybody knows what?
Please suggest what?
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 460
Location: Richmond, Virginia

PostPosted: Fri May 09, 2008 6:02 pm    Post subject:
Reply with quote

I would be embarrassed to write a compiler that would let you have a value -0, and also embarrassed to show -0 on a report or screen.

In other words, what are the actual specs, and from what kind of user?
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 252
Location: Spain

PostPosted: Fri May 09, 2008 6:07 pm    Post subject:
Reply with quote

I have the same doubts as CICS Guy
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 998
Location: At my desk

PostPosted: Fri May 09, 2008 6:13 pm    Post subject:
Reply with quote

FWIW, I noticed this a couple weeks back while researching in the PoOp for another topic question....
Under some circumstances, a zero with a minus sign (negative zero) is produced. For example, the multiplicand:
00 12 3D (-123)
times the multiplier:
0C (+0)
generates the product:
00 00 0D (-0)
because the product sign follows the algebraic rule of signs even when the value is zero. A negative zero, however, is equivalent to a positive zero in that they compare equal in a decimal comparison.
Back to top
View user's profile Send private message
birdy K

New User


Joined: 05 Mar 2008
Posts: 14
Location: chennai

PostPosted: Mon May 12, 2008 10:18 am    Post subject:
Reply with quote

Hai everybody

Sorry for the Delay. I was out of my station. Thank You CICS Guy. I asked How to include - sign with zero. Anyway It is meaningless. But Onsite asked me to do that. Now they dont need that. But I am interested to know. So I asked your suggestion. When I asked your suggestion. I didnt see CICS Guy post. Thank you for all.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe COBOL All times are GMT + 6 HoursGoto page Previous  1, 2
Page 2 of 2