There are two type of formats for decimal numbers:
1. Zoned Decimal
2. Packed Decimal
1. Zoned Decimal Numbers
-- each byte present 1 numeric value.
-- the sign mark is placed at last byte (
F means an unsigned, C means a positive, D means a negative)
-- for example
123
=> 0x F1 F2 F3
("123")
+1234
=> 0x F1 F2 F3 C4
("123D"),
0xC4 == 'D'
-
12345 => 0x F1 F2 F3 F4 D5
("1234N"),
0xD5 == 'N'
With EBCDIC coding, '0' = 0xF0, '1'=0xF1, '2'=0xF2, ..., '9'=0xF9
2. Packed Decimal Numbers (COMP-3)
-- each byte present 2 numeric values (but the last byte)
-- the sign is placed at the most-right 4 bits; so the last byte present a numeric value and the sign mark
-- for example
123
=> 0x 12 3F
+1234
=> 0x 01 23 4C
-
12345 => 0x 12 34 5D
(Compared with ZD, where the sign mark is placed at first half-byte, PD use second half-byte as sign mark)
EBCDIC please refer to
https://zh.w ikipedia.org /wiki/EBCDIC
577

被折叠的 条评论
为什么被折叠?



