MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

sign leading separate comparision

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
kraj
Beginner


Joined: 15 Apr 2004
Posts: 8
Topics: 2

PostPosted: Sun Nov 14, 2004 6:07 pm    Post subject: sign leading separate comparision Reply with quote

Hello,
Our system is Unisys 2200.
I am trying to compare a field declared like this.

01 WH-AMT PIC S9(09)v99 SIGN LEADING SEPARATE.

IF WH-AMT < 0
do negative process
ELSE
do positive process
END-IF.

Even when I get minus amount , it is always going to positive process.
Any help is appreciated.
thanks.
kraj.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Sun Nov 14, 2004 7:14 pm    Post subject: Reply with quote

kraj,

I have never worked on unisys, but I am expecting it to function the same way as the cobol on mainframe does. Your logic works fine on the mainframe. Put a display and see if that works.

Code:


MOVE -5 TO  WH-AMT                             
DISPLAY 'WH AMT: ' WH-AMT                       
                                             
IF WH-AMT < 0                                   
   DISPLAY  ' I AM IN THE NEGATIVE PROCESSING' 
ELSE                                           
   DISPLAY  ' I AM IN THE POSITIVE PROCESSING' 
END-IF.                                         


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kraj
Beginner


Joined: 15 Apr 2004
Posts: 8
Topics: 2

PostPosted: Sun Nov 14, 2004 9:39 pm    Post subject: Reply with quote

Thanks Kolusu.
I put display , it is going to positive process.During that time the value was -197.04. ( But I did not move the value as you said.)
Even I tried CBL NUMPROC (PFD) ----> (got from your previous post).
If I miss some thing, again I 'll try on Monday and post the results.

Thanks Kolusu.
kraj.
Back to top
View user's profile Send private message
Ganti
Beginner


Joined: 04 Dec 2002
Posts: 8
Topics: 3
Location: St.Louis, MO, USA

PostPosted: Mon Nov 15, 2004 10:35 am    Post subject: Reply with quote

Try This:

01 WH-AMT PIC S9(09)v99 SIGN LEADING SEPARATE.
01 WH-AMT-ZERO PIC S(09)V99 SIGN LEADING SEPARATE.
...
MOVE 0 TO WH-AMT-ZERO.
DISPLAY 'THIS IS ZERO ' , WH-AMT-ZERO.
IF WH-AMT < WH-AMT-ZERO
DISPLAY ' I AM NEGATIVE'
ELSE
DISPLAY ' I AM POSITIVE'

I am wondering if there is any difference in the way a compare happens for a sign leading separate declaration.

I have not worked on UNISYS, maybe this will work.

regards
Ganti
It Is Nice To Be Important But It Is More Important To Be Nice
Back to top
View user's profile Send private message
kraj
Beginner


Joined: 15 Apr 2004
Posts: 8
Topics: 2

PostPosted: Tue Nov 16, 2004 12:16 am    Post subject: FYI Reply with quote

Thanks Kolusu & Ganti.

Actually we are getting WH-AMT value from WT-AMT filed.
Now what we did is :
01 WT-AMT PIC -(9).99.
01 WH-AMT PIC S(9).99.

declared like above.
Now it is working .

thanks.
kraj.
Back to top
View user's profile Send private message
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Wed Nov 17, 2004 11:30 am    Post subject: Reply with quote

kraj,
Quote:
Now what we did is :
01 WT-AMT PIC -(9).99.


The above definition involves editing characters; the minus sign. Ergo, it effectively becomes a character variable. Thus, you are comparing character and numerics. I am curious if it is OK.
_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
kraj
Beginner


Joined: 15 Apr 2004
Posts: 8
Topics: 2

PostPosted: Fri Nov 19, 2004 1:17 pm    Post subject: Reply with quote

Cogito-Ergo-Sum,
you are correct. Before comparing , that was moved to
wt-amt pic s(9).99.

thanks.
kraj.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group