View previous topic :: View next topic
|
Author |
Message |
murugan_mf
Active User
Joined: 31 Jan 2008 Posts: 148 Location: Chennai, India
|
|
|
|
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 |
|
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
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. |
|
Back to top |
|
|
murugan_mf
Active User
Joined: 31 Jan 2008 Posts: 148 Location: Chennai, India
|
|
|
|
Craq,
Thanks a lot!!! |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Or:
Code: |
field1 pic 9(2)v9(2)
if field1(3:2) Not = Zeros
some process
end-if. |
|
|
Back to top |
|
|
|