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



Michael_Smith@xxxxxxxxxxxxxx wrote:
I have a database that was created via DDS and I'm trying to change
a zoned decimal field via a SQL statement. The statement is being
executed from interactive (STRSQL) SQL. The field definition is:

PREMDUE ZONED 11 2 ... Both PREMDUE

When I look at other positive values via DSPPFM and toggle to hex I
see the sign value, positive or negative. Such as, if the value was
+2683.55 then the hex value is F2F6F8 F3F5C5 or if it was -2683.55
then the hex value would be F2F6F8 F3F5D5.

When I try to issue my SQL command:

UPDATE table name SET PREMDue = +2683.55 WHERE blah blah = whatever

In hex, I see F2F6F8 F3F5F5

or when I try a negative value, I see F2F6F8 F3F5D5

So, my question is, why don't I see the C5 for the positive but
rather, I see a F5 instead.

The i5/OS supports two Binary Coded Decimal [BCD] representations: signed Packed decimal and signed Zone[d] decimal. Both of those decimal representations use the "preferred positive" sign nibble of 0xF and the "preferred negative" sign nibble of 0xD. All of the nibbles 0xA to 0xF are valid sign nibbles in both of these representations on i5/OS; all of the nibbles 0x0 to 0x9 are invalid as sign values. The IBM EBCDIC "mainframe" operating systems [I believe all] use 0xC as the "preferred positive" sign nibble.

Being the "preferred" sign, any BCD data that is loaded and written will be updated to reflect that preference; i.e. at least without some override to the behavior, for example a compile option on the COBOL compiler might and could effect 0xC for compatibility with the mainframe OSes.

http://www.google.com/search?q=bcd+"binary+coded+decimal"+"sign+nibble";
http://en.wikipedia.org/wiki/Binary-coded_decimal

Regards, Chuck

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.