> i have the following 0000090J in a numerical field, what does the J mean.
> I know it has something to do with a negative value, but my brain has been
> drain and this eludes me.

If you look up the EBCDIC code for numbers, zero is x'F0' and nine is
x'F9' with the other numbers falling in between.

So, the first 4 bits of a number in EBCDIC is always 1111 (or, hex F)...
effectively, those bits aren't used since they're always the same, right?
Well, IBM decided that rather than waste another byte to specify a
positive or negative sign, they'd just use those "unused" bits of the last
digit in the number.  By changing it from 1111 to 1101, they indicate that
the number is negative.

So, for the last digit, x'F0' - x'F9' represents the number 0-9 if it's a
positive number, and x'D0' - x'D9' represents the numbers 0-9 if the field
is negative.

In your example, you've got 0000090J.  The letter J is hex x'D1' in
EBCDIC -- it represents a negative number where the last digit is 1.
In this case -901  (if there are no decimal places, otherwise it might be
-0.901 or -9.01, etc)

In IBM's terminology the D in x'D1' represents the number's "zone" and the
1 represents the numbers "digit".  That's why this field is referred to as
a "zoned decimal" field, because digit of the number has a zone associated
with it. (The last zone indicates positive or negative.)

HTH




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.