View previous topic :: View next topic |
Author |
Message |
kraj Beginner
Joined: 15 Apr 2004 Posts: 8 Topics: 2
|
Posted: Sun Nov 14, 2004 6:07 pm Post subject: sign leading separate comparision |
|
|
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
|
Posted: Sun Nov 14, 2004 7:14 pm Post subject: |
|
|
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 |
|
|
kraj Beginner
Joined: 15 Apr 2004 Posts: 8 Topics: 2
|
Posted: Sun Nov 14, 2004 9:39 pm Post subject: |
|
|
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 |
|
|
Ganti Beginner
Joined: 04 Dec 2002 Posts: 8 Topics: 3 Location: St.Louis, MO, USA
|
Posted: Mon Nov 15, 2004 10:35 am Post subject: |
|
|
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 |
|
|
kraj Beginner
Joined: 15 Apr 2004 Posts: 8 Topics: 2
|
Posted: Tue Nov 16, 2004 12:16 am Post subject: FYI |
|
|
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 |
|
|
Cogito-Ergo-Sum Advanced
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
|
Posted: Wed Nov 17, 2004 11:30 am Post subject: |
|
|
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 |
|
|
kraj Beginner
Joined: 15 Apr 2004 Posts: 8 Topics: 2
|
Posted: Fri Nov 19, 2004 1:17 pm Post subject: |
|
|
Cogito-Ergo-Sum,
you are correct. Before comparing , that was moved to
wt-amt pic s(9).99.
thanks.
kraj. |
|
Back to top |
|
|
|
|