I wondered about the various possible nybbles that can be there for negative - did not remember or know of those for positive - are there more? Various references on the 'Net suggest there are only C & F for positive, D for negative. Adding another range is easy enough, it it'll take care of the problem.


CRPence wrote:
As noted in another post, the EBCDIC 0xF0 to 0xF9 are merely the /preferred positive/ on the i, but other values are allowed. So for instance if the /flat file/ data had been generated somewhere else, e.g. on a system z, the positive data\values might have the 0xC0 to 0xC9 as the sign digit, instead of the 0xF0 to 0xF9. Thus the quoted solution would return negative values, for what are actually supposed to be positive values.

I am out west and so unsure, unlikely actually, if I will be back in Rocs anytime soon.

Regards, Chuck

Vern Hamberg wrote:
Had forgot about that - it does the trick and beautifully!
Here's the result -

when substr(chr1,length(chr1),1) between '0' and '9' then 1
else -1
end *
substr(chr1,1,length(chr1)-1) concat
lor(x'F0', substr(chr1,length(chr1),1))
FROM vern/chrtozon

The CASE construct determines the sign.

The LOR forces the final character to a positive number.

So it's the sign times the absolute value - which would not be
usable here, I suppose.


BTW, I'll be in Rochester mid-November - maybe can get together.

This thread ...


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

This mailing list archive is Copyright 1997-2020 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].