× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



currently they manually round up. Yes 2 pounds becomes 3 pounds,. What this
is, is that we will get the Worldship software from UPS. instead of manually
weighing each package we will supply UPS with the weight and service, model
number and QTY. This I get from our files. THen it goes into Worldship via a
file batch update. THen the user calls up Worldship, scans the printed
invoice number into Worldship and it provides them with information for
packing and so forth.



SInce there is leeway in the packing it makes more sense to round up the
numbers than to precisely weigh each one,



Although I would love to hear how other folks are doing this for the consumer
marketplace via Worldship.



Thanks

--- On Tue, 5/20/08, Adam Glauser <adamglauser@xxxxxxxxxxxx> wrote:

From: Adam Glauser <adamglauser@xxxxxxxxxxxx>
Subject: Re: Technique for rounding up
To: rpg400-l@xxxxxxxxxxxx
Date: Tuesday, May 20, 2008, 1:04 PM

Adam West wrote:
> the problem is with a whole number, something that weighs 2 pounds.

> Currently, they manually round up to next pound regardless. but 2
always
> remains at 2.


Are you describing the correct behaviour for the algorithm, or the
incorrect behaviour that you want to correct? That is, if you have
weight = 2.0, should the result be 2.0 or 3.0?

In the first case, the CEILING function mentioned by Birgitta is as good
a choice as any. The ceil() function is also callable as part of the
C/C++ runtime. Booth's suggestion is a way to implement the CEILING
function if choose not to use embedded SQL or an API call, but be aware
that it will need to be modified depending on the number of decimal
places in your weight field:
%int(2.01 + 0.9) = %int(2.91) = 2.0

In case you want 2.0 to become 3.0, you could use
newWeight = FLOOR(originalWeight + 1).

Hope this helps,
Adam
--
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.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.