|
Sadiq:
<snip>
I understand the meaning of packed decimal when compared to zoned as
Packed decimal means N X 2 - 1 where "N" stands for length as an example
6p(2) will accommodate 6 X 2 - 1 = 11 length out of which two are
decimal
values , where as 6S(2) zoned has only a value of six length out of
which
two are decimal
</snip>
Actually, you don't understand the meaning of packed. An 11,2 field,
whether packed or zoned, contains a maximum value of 999,999,999.99.
The difference is in how it is stored in the database. A zoned field
takes up the full 11 bytes of storage. A packed field size is
calculated as (N+1)/2, in this case a length of 6 bytes. But the field
is still 11,2 and still contains a maximum value of 999,999,999.99. In
DDS the definitions would be
A ZONED 11S 2
A PACKED 11P 2
In hex, the fields look like this:
Zoned FFFFFFFFFFF
99999999999
Packed 999999
99999F
The "F" in the digit portion of the last byte is the sign of the field
(C or F is positive, D is negative).
Whether you use RPG, COBOL, DFU, SQL or any other tool, that packed
field still is only 11,2.
Hope that helps,
--Bruce Guetzkow
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.