Hi,
Just use the SQL scalar function CEILING or CEIL.
Ceiling rounds up to the next integer value, that means
1.00 --> 1
1.01 --> 2
1.99 --> 2
-1.00 --> -1
-1.9 --> -1
-1.01 --> -1
Example:
Exec SQL Set :MyRoundUp = CEILING(:MyResult);
Exec SQL Set :MyRoundUp = Ceiling(Expression or Formula);
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im
Auftrag von Alan Shore
Gesendet: Monday, May 19, 2008 22:35
An: RPG programming on the AS400 / iSeries
Betreff: Re: Technique for rounding up
Hi Adam
if I understand your question correctly.
The weight of the order SHOULD include the weight of any and all boxes used
for the shipment. As far as the weight are concerned if you hold the weight
in pounds/kilos to a number of decimal places then move this value to
another field with zero decimal places and compare
DWeighttrue s 9 2
DWeight s 9 0
Weight = Weighttrue;
if Weighttrue > Weight;
Weighttrue = Weight + 1;
endif;
However if you hold the weight in 2 seperate fields
DPound s 9 2
DOunces s 4 2
if Ounces > 0;
clear Ounces;
Pounds += 1;
endif;
Alan Shore
Programmer/Analyst, Direct Response
E:AShore@xxxxxxxxxxx
P:(631) 244-2000 ext. 5019
C:(631) 880-8640
"If you're going through Hell, keep going" - Winston Churchill
Adam West
<adamster@xxxxxxx
om> To
Sent by: rpg400-l@xxxxxxxxxxxx
rpg400-l-bounces@ cc
midrange.com
Subject
Technique for rounding up
05/19/2008 04:23
PM
Please respond to
RPG programming
on the AS400 /
iSeries
<rpg400-l@midrang
e.com>
HI What is a good way to round up a part that has the weight, for
shipping
purposes? Because when actually packed for UPS there is that extra
packing
box, etc.
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or
change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.