November 21, 2007, 11:34 AM
LeahLooks as if you need to do some math figuring, if you calculate in decimal mode add .9 to the answer and then convert the output to integer which truncates would that work? In math terms
3.12285 + .9 = 4.02285 integer is 4
3.5 + .9 = 4.5 integer is 4
might work for you.
November 22, 2007, 05:27 AM
mark66Many thanks Prarie & Leah.
Looks like you both came along at the same time with different solution, both of which work great for me.
I knew it would be something simple, but I was getting hung up on the ROUND function.
Thanks again
November 22, 2007, 06:22 AM
Danny-SRLMark,
If you
always want to round up then you have to beware of two possibilities:
1. your number is a whole number to begin with
2. your number is slightly over a whole number.
I suggest, if your original field is FIELD/D8.2:
WFIELD/D8=INT(FIELD);
UPFIELD/D8=IF FIELD EQ WFIELD THEN FIELD ELSE WFIELD + 1;
November 22, 2007, 09:27 AM
mark66Thanks Danny,
I hadn't spotted that. 7 รท 1 was equal to 2, not 1. Now corrected.
November 23, 2007, 04:47 AM
susannahI might consider a refinement
use one of the MOD functions (DMOD,FMOD,IMOD)
to determine whether or not your remainder
really is zero.
Just comparing the FIELD to the WFIELD
isn't quite reliable, because that FIELD may appear to be 8.0 and its integer value ,8, would equal WFIELD, however these D fields carry decimal leave-behinds way down in the 32nd digit (or however far they really go internally ) so a MOD of FIELD/WFIELD will either equal 0 if they are truly equal
or not 0, if they're even a negligible bit off.
November 23, 2007, 10:16 AM
iraTry
xdefine/d8.2 = database_field + .05;
ydefine/d8 = int(xdefine);
ira w. 5.3.6 aix 533