Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
murugan_mf

Active User

Joined: 31 Jan 2008
Posts: 148
Location: Chennai, India

Posted: Tue Mar 17, 2009 8:48 pm    Post subject: How to find if the decimal part contains a non zero value

Hi,

My requirement is to find out whether the decimal part contains a non zero value. I am using the below logic to find this and it works fine.
But I am certain, there must be a better way to do this.

Example:

 Code: field1 pic 9(2)v9(2)  field2 pic 9(2)v9(2)  Compute field1 Rounded = field2  If field1 not = field2     some process  End-if

Craq Giegerich

Senior Member

Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

Posted: Tue Mar 17, 2009 9:11 pm    Post subject:

Just redefine field1 as
 Code: 03 field1 pic 9(2)v9(2)  03 field2 redefines field1.       04      pic xx.       04 field2-dec pic 99. if field2-dec Not = 0     some process end-if.

This avoids the extra processing for the compute.
murugan_mf

Active User

Joined: 31 Jan 2008
Posts: 148
Location: Chennai, India

 Posted: Tue Mar 17, 2009 9:23 pm    Post subject: Craq, Thanks a lot!!!
CICS Guy

Senior Member

Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

Posted: Tue Mar 17, 2009 9:46 pm    Post subject:

Or:
 Code: field1 pic 9(2)v9(2) if field1(3:2) Not = Zeros     some process end-if.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics How can I convert charactor to fixed ... liying DFSORT/ICETOOL 4 Tue May 22, 2018 3:35 pm Linkage editor is part of COBOL, z/OS... ankit.jain COBOL Programming 5 Fri Apr 20, 2018 4:17 pm Find & Replace string in CA-SORT mrgnndhmk CA Products 1 Fri Mar 30, 2018 12:58 am How to group and sum the decimal value sakrat DFSORT/ICETOOL 2 Tue Mar 06, 2018 9:13 pm Find a string in PS file opened in br... mukkas CLIST & REXX 3 Sat Feb 24, 2018 2:15 pm

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us