sign stored in Packed Decimal fields and Zoned Decimal field

cobol interview questions

Moderator: Moderator Group

Post Reply
User avatar
Krishna
Site Admin
Posts: 1052
Joined: Fri Jan 27, 2006 7:50 am

sign stored in Packed Decimal fields and Zoned Decimal field

Post by Krishna » Sun Jul 19, 2009 4:11 pm

How is sign stored in Packed Decimal fields and Zoned Decimal fields?

User avatar
Krishna
Site Admin
Posts: 1052
Joined: Fri Jan 27, 2006 7:50 am

Post by Krishna » Sun Jul 19, 2009 4:11 pm

Packed Decimal fields: Sign is stored as a hex value in the last nibble (4 bits ) of the storage.

Zoned Decimal fields: As a default, sign is over punched with the numeric value stored in the last bite.

sambit_mech
Member
Posts: 9
Joined: Wed Jul 14, 2010 11:17 am
Location: India

Post by sambit_mech » Wed Jul 14, 2010 11:40 am

Packed decimal:
Signed numeric -
+1234 ---> in hex

024
13C

-1234 ---> in hex

024
13D

Unsigned numeric -

1234 ---> in hex

024
13F

Zoned Decimal:

Signed numeric -
+1234 ---> 123D in EBCDIC
-1234 ---> 123M in EBCDIC

Unsigned numeric -
1234 ---> 1234 in EBCDIC

How the sign is punched?
} -0
{ 0
A 1
B 2
C 3
D 4
E 5
F 6
G 7
H 8
I 9
J -1
K -2
L -3
M -4
N -5
O -6
P -7
Q -8
R -9
"By failiing to prepare, you are preparing to fail." - Benjamin Franklin

Post Reply