How is sign stored in Packed Decimal fields and Zoned
Decimal fields?
Answer Posted / arjun k r
for packed decimal ,one or more bytes hold a decimal integer, where each of the two nibbles of each byte represent a decimal digit, with the more significant digit in the upper half of each byte, and with leftmost byte (residing at the lowest memory address) containing the most significant digits of the packed decimal value. The lower nibble of the rightmost byte is usually used as the sign flag.
Standard sign values are 1100 (hex C) for positive (+) and 1101 (D) for negative (−).
number −1,234,567 is 7 digits wide and is encoded as:
0001 0010 0011 0100 0101 0110 0111 1101
1 2 3 4 5 6 7 −
For Zoned Decimal, Each decimal digit is stored in one byte, with the lower four bits encoding the digit in BCD form. The upper four bits, called the "zone" bits, are usually set to a fixed value so that the byte holds a character value corresponding to the digit.
For signed zoned decimal values, the rightmost (least significant) zone nibble holds the sign digit.Thus a zoned decimal value encoded as the hex bytes F1 F2 D3 represents the signed decimal value −123:
F1 F2 D3
1 2 −3
Source : Wikipedia
| Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
What are 77 levels used for?
how do you reference the ksds vsam file formats from cobol programs
What is the compute verb? How is it used?
i want a program using by if, evaluate , string, unstring, perform, occurs?
What is the difference between PIC 9.99 and 9v99 in COBOL?
How do you reference the following file formats from cobol programs?
How do you differentiate between cobol and cobol-ii?
) what is the difference between AID and HANDLE AID?
What are the different rules for performing sort operation?
What the difference is between continue and next sentence?
Our issue is there seems to be a disconnect, or no link, between our SELECT statement and our SD. We had SELECT SORT-FILE and SELECT SORT-FILE ASSIGN TO SORTWRK. ASSIGN TO SORTWRK1 SORTWRK2 SORTWRK3 SORTWRK4. with SD SORT_FILE RECORD CONTAINS 7833 CHARACTERS. In either case, at run time, the system ignored our SORTWRK# DD statements and allocated 16 sort works with the SORTWK## naming convention. Any ideas why the system does not recognize the connection? We do not even need the SORTWRK DD statements. Thanks
how do you reference the variable unblock file formats from cobol programs
Which is not true about evaluate statement
please..could u give an example about USAGE IS POINTER ..and explain why and when we use it ?
What are the pertinent COBOL