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: 1228
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
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm
No new posts Checking Current date vickey_dw DFSORT/ICETOOL 1 Wed Feb 08, 2017 11:14 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm


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