× 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.



I think earlier we suggested that you should wrap the %dec in a MONITOR block if you wanted to catch errors. That’s what you need to do here.

So you need something like this to allow the error to be handled.

Monitor;
ord_wt = %dec(PHWtot:7:2);
On-Error; // This will trap all errors. Use more specific codes if needed
Dsply (‘Value ‘ + PHWtot + ‘ is not a valid number’);
EndMon;


Jon Paris

www.partner400.com
www.SystemiDeveloper.com

On Apr 19, 2015, at 1:26 PM, Hoteltravelfundotcom <hoteltravelfun@xxxxxxxxx> wrote:

i have coded this: eval ord_wt = %dec(PHWtot:7:2) but still
got error of data decimal error.

To locate this I have taken a D' and have the program dump.

Is this all i need> here it will tell me which is the bad data?

other wise can I code in the RPG to handle such an occurance?


On Wed, Apr 15, 2015 at 9:04 AM, Hoteltravelfundotcom <
hoteltravelfun@xxxxxxxxx> wrote:

there is decimals yes, so yes rounded like you say would be the way to go,
thanks.

On Tue, Apr 14, 2015 at 7:41 PM, Barbara Morris <bmorris@xxxxxxxxxx>
wrote:

On 2015-04-13 18:01, Hoteltravelfundotcom wrote:

HI I Have to move a data value (weight of an item) which is char 11 into
a
numeric 7 02
field.


Is it possible that the character value represents a value with decimal
places? If so, what does it look like?

If a value like '12345' actually means 123.45, then %DEC won't work by
itself. You'd have to multiply the result by 0.01.

But if a value with decimal places is something like '123.45', and a
value like '12345' means 12345, then %DEC will work fine.

If the character value might have more than two decimal places, say
'123.459', then you should use %DECH to get it rounded to 123.46.

--
Barbara


--
This is the RPG programming on the IBM i (AS/400 and 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.



--
This is the RPG programming on the IBM i (AS/400 and 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.