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 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe COBOL
Author Message
birdy K

New User


Joined: 05 Mar 2008
Posts: 14
Location: chennai

PostPosted: Fri May 09, 2008 12:06 pm    Post subject: Comp-3 to hold negative Zero
Reply with quote

Hello everybody,

I need -0 value. So I thought ,

01 fval pic -9(05) value zero.
01 sval pic s9(06).
01 tval pic s9(05) comp-3.

If i move from fval to sval. and Then move from sval to tval. I will get
-0. I didnt test it that. Can anyone tell whether this will work perfectly?
I think I am right. If there is anything wrong. Please forgive me.
Back to top
View user's profile Send private message
References
PostPosted: Fri May 09, 2008 12:06 pm    Post subject: Re: Comp-3 to hold negative Zero Reply with quote

the_gautam

Active User


Joined: 05 Jun 2005
Posts: 100
Location: Bangalore

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

first of all, tell me the meaning and use of the value (-0)
Back to top
View user's profile Send private message
birdy K

New User


Joined: 05 Mar 2008
Posts: 14
Location: chennai

PostPosted: Fri May 09, 2008 2:06 pm    Post subject:
Reply with quote

Hai gautam I need to display as such.
Back to top
View user's profile Send private message
sri_mf

Active User


Joined: 31 Aug 2006
Posts: 120
Location: At my Desk

PostPosted: Fri May 09, 2008 2:18 pm    Post subject: Re: Comp-3 to hold negative Zero
Reply with quote

birdy K wrote:
Hello everybody,

I need -0 value. So I thought ,

01 fval pic -9(05) value zero.
01 sval pic s9(06).
01 tval pic s9(05) comp-3.

If i move from fval to sval. and Then move from sval to tval. I will get
-0. I didnt test it that. Can anyone tell whether this will work perfectly?
I think I am right. If there is anything wrong. Please forgive me.


why can not you try and let us know the results?
Back to top
View user's profile Send private message
birdy K

New User


Joined: 05 Mar 2008
Posts: 14
Location: chennai

PostPosted: Fri May 09, 2008 2:48 pm    Post subject:
Reply with quote

Thank you sri . I tried . Its not working fine.
Is there any other way to get -0 value?
Back to top
View user's profile Send private message
ashimer
Warnings : 1

Active User


Joined: 13 Feb 2004
Posts: 113

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

You cannot move fval to sval it will give you error cos you are moving a numeric edited field.
Back to top
View user's profile Send private message
sri_mf

Active User


Joined: 31 Aug 2006
Posts: 120
Location: At my Desk

PostPosted: Fri May 09, 2008 3:17 pm    Post subject:
Reply with quote

birdy K wrote:
Thank you sri . I tried . Its not working fine.
Is there any other way to get -0 value?


U have to use editing data types to display that.
Ex: 01 fval pic -9(05) value zero.
display FVAL.

Correct me if i m wrong.
Back to top
View user's profile Send private message
ashimer
Warnings : 1

Active User


Joined: 13 Feb 2004
Posts: 113

PostPosted: Fri May 09, 2008 3:25 pm    Post subject:
Reply with quote

If you just need to display -0 and no computations involved then do this

01 fval pic x(2).

move x'60F0' to fval

this will give the value of fval as -0.


thanks,
ashimer
Back to top
View user's profile Send private message
sri_mf

Active User


Joined: 31 Aug 2006
Posts: 120
Location: At my Desk

PostPosted: Fri May 09, 2008 3:30 pm    Post subject:
Reply with quote

ashimer wrote:
If you just need to display -0 and no computations involved then do this

01 fval pic x(2).

move x'60F0' to fval

this will give the value of fval as -0.


thanks,
ashimer


ashimer its workibg fine. can u explain it.

I tried this.

01 TVAL PIC S9(05) COMP-3 VALUE ZERO.
01 FVAL PIC -9(05).

Move tval to fval.
Display fval.
But it is displaying zeros only. No negative sign.Can any one throw some lite on this.
Back to top
View user's profile Send private message
ashimer
Warnings : 1

Active User


Joined: 13 Feb 2004
Posts: 113

PostPosted: Fri May 09, 2008 3:36 pm    Post subject:
Reply with quote

The hex value for -0 is 60F0... i just moved this value to fval ...

here you tval even though its s9(5) it wont have a sign over here as the value is 0 and you are moving this value ie zero to fval ..
Back to top
View user's profile Send private message
birdy K

New User


Joined: 05 Mar 2008
Posts: 14
Location: chennai

PostPosted: Fri May 09, 2008 3:41 pm    Post subject:
Reply with quote

I need this in comp-3 field.
Back to top
View user's profile Send private message
the_gautam

Active User


Joined: 05 Jun 2005
Posts: 100
Location: Bangalore

PostPosted: Fri May 09, 2008 3:49 pm    Post subject:
Reply with quote

earlier you said that you have to display it in that format (-0).
now you are saying that you want it to be in a COMP-3 variable.

are you willing to say that you are displaying a COMP-3 variable.
Back to top
View user's profile Send private message
birdy K

New User


Joined: 05 Mar 2008
Posts: 14
Location: chennai

PostPosted: Fri May 09, 2008 4:31 pm    Post subject:
Reply with quote

No I am not displaying comp-3 field. My work is to move from assembler to cobol. In assembler coding they are moving -0 to display. So the same way I have to do.

I tried this

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.
Back to top
View user's profile Send private message
the_gautam

Active User


Joined: 05 Jun 2005
Posts: 100
Location: Bangalore

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

its obvious that you will not get it directly, since 0 is not a negative value.

since, you just have to display it, why dont you use the code that ashimer posted.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 709
Location: Virginia, USA

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

1. -0 is a meaningless term.

2. The basic rules of COBOL prohibit -0.
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 1, 2  Next
Page 1 of 2