Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Checking for Zeros in a Variable

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Checking for Zeros in a Variable
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: 1224
Location: Israel

PostPosted: Wed Feb 17, 2010 2:26 pm    Post subject: Re: Checking for Zeros in a Variable
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Checking wether a string starts from ... sundaram.naveen CLIST & REXX 9 Thu Oct 06, 2016 11:56 am
No new posts Syncsort - NULL in Integer field chec... nartcr SYNCSORT 4 Thu Oct 06, 2016 6:47 am
No new posts Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm
No new posts Reasonable way of checking wildcards ... sergeyken CLIST & REXX 5 Wed Sep 07, 2016 8:43 pm
No new posts Variable for cursor names ravikumar15 DB2 5 Sun Jul 17, 2016 7:08 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us