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 happens if parmparameter passes zero bytes to the program
Name the sections present in data division.
how do you reference the esds vsam file formats from cobol programs
how do you define single dimensional array and multidimensional array in your cobol?
How to remove the spaces at the end of each record in the output file of variable length, via cobol program?
What are different data types in cobol?
What is the Purpose of POINTER Phrase in STRING command in COBOL?
here is my requirement A1 is alphanumeric with value 'A1B2C3D4' as defined below 05 A1 PIC X(8) VALUE IS 'A1B2C3D4' but i need to have A2,A3 as ABCD & 1234 repectively...... A2 = ABCD A3 = 1234 Can you please explain me what are the different ways to do it?
Write a program that uses move corresponding.
1.give the details about WHEN OTHER. 2. how many form are available in evaluate.
Write some characteristics of cobol as means of business language.
what is the difference between COBOL2 AND COBOL390?
How to fetch 1000 error records from VSAM file(Eg: 1000000 records present) while getting SOC7 abend ?
What is the local-storage section?
What are literals?