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

Checking for Zeros in a Variable


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sijayapal

New User


Joined: 23 Dec 2008
Posts: 69
Location: India

PostPosted: Wed Feb 17, 2010 1:11 pm
Reply with quote

Hi,

Code:

COMPUTE WS-P2-WRITTEN-PREM     ROUNDED =     
                      WS-HOLD12-WRITTEN-PREM.
COMPUTE WS-P2-EARNED-PREM     ROUNDED =       
                      WS-HOLD12-EARNED-PREM. 
COMPUTE WS-P2-PAID-LOSSES     ROUNDED =       
                      WS-HOLD12-PAID-LOSSES. 
COMPUTE WS-P2-OS-LOSSES     ROUNDED =         
                      WS-HOLD12-OS-LOSSES.   


Code:


 IF WS-P2-WRITTEN-PREM     = ZEROES AND               
    WS-P2-EARNED-PREM      = ZEROES AND               
    WS-P2-PAID-LOSSES      = ZEROES AND               
    WS-P2-OS-LOSSES        = ZEROES                   
       MOVE 'Y'                 TO  WS-ALL-ZEROES-SW   
 END-IF.                                               


if the value is less than 0.5 it is getting rounded to 0.. but the if condition is failing. I do not understand what is the problem. The WS-P2-WRITTEN-PREM has a picture class of -zzzzzzzzz9
WS-HOLD12-WRITTEN-PREM has a pic class of s9(11).99
Please help me in resolving the issue.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Wed Feb 17, 2010 2:26 pm
Reply with quote

sijayapal wrote:
but the if condition is failing. I do not understand what is the problem.
Got zero answers? maybe you should think about the way you asked your question...

WS-P2-WRITTEN-PREM has the format USAGE DISPLAY.
After your compute, the field will have '__________0' (_ stands for space)
It is not a numeric compare: the string '__________0' is not equal to ZERO ('00000000000')
That's why "it fails".
6.1.6.5 General relation conditions
Back to top
View user's profile Send private message
sijayapal

New User


Joined: 23 Dec 2008
Posts: 69
Location: India

PostPosted: Wed Feb 17, 2010 3:13 pm
Reply with quote

Thanks Marso..
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts Moving Or setting POINTER to another ... COBOL Programming 2
No new posts parsing variable length/position data... DFSORT/ICETOOL 5
No new posts Masking variable size field - min 10 ... DFSORT/ICETOOL 4
Search our Forums:

Back to Top