On 19 April 2015 at 13:26, 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?
The dump will show you the contents of PHWtot. The contents of PHWtot
cannot be converted to a number via the %DEC() BIF, so you need to do
something else.
other wise can I code in the RPG to handle such an occurance?
As the programmer, you can do quite a few things in RPG to deal with
the situation. Only you can know what is proper for this particular
situation: no one on this list can tell you what your business rules
are, or ought to be. As Chuck notes, in some situations you might be
fine to set ord_wt to zero. In some situations it would be a very bad
thing to not know the order weight.
There is one question I haven't heard you answer yet. Why is PHWtot a
character field? The point of the question is this: often, when one
receives a file from a trading partner and that file has 'numeric'
data that looks like this '12,785.5# FOB Detroit' it is because one is
receiving something meant for a person to read, not a computer. In
many cases, the trading partner can supply a file that is unedited,
that is intended for a computer to read. Yes, I realise that the
trading partner in your case is your new software, but the point still
stands.
I have walked many miles in your shoes and I strongly recommend that
you try to get a better input file.
--buck
As an Amazon Associate we earn from qualifying purchases.