×
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.
On 5/10/2013 9:56 AM, Florin Todor wrote:
ds_hresD01 = f_in210txt;
// DS_HRESD01.D1CHGAMT = -793.49<---- from Debug session
eval-corr ds_detD01 = ds_hresD01;
// D1CHGAMT OF DS_DETD01 = 0000000793.49<---- from Debug session
That's interesting that the debugger shows the zoned value that way. If
that '-' character happened to be '/', the debugger would show the value
of DS_HRESD01.D1CHGAMT as /793.49.
And it's interesting that RPG doesn't mind the '-' as one of the zoned
decimal digits. I believe it is allowed because the hex value of '-' is
x'60', and for zoned arithmetic, only the digit part, x'0' in this case
is used. The zone part, x'6' in this case, is ignored for all except the
sign byte (the last byte, where only zones of x'A' to x'F' are allowed).
If you happened to have x'61', '/', where you have the '-' character, it
would be interpreted as a 1, and the result would be 1793.49.
And if you happened to have the '+' character, x'4e', you would get
decimal data error on the eval-corr.
I think you should just define DS_HRESD01.D1CHGAMT as character, so
EVAL-CORR will skip it, and then handle it separately as Chris
suggested. I am assuming you have other subfields in the data
structures, otherwise, there is no real need for eval-corr; eval will do.
I'm surprised that the data in f_in210txt has the numeric value as half
character, with the minus sign as part of the data, and half numeric,
not showing a decimal point. It would be somewhat easier to process in
RPG if it had both the sign and the decimal point because then you could
just use %dec directly, without having to divide by 100.
As an Amazon Associate we earn from qualifying purchases.