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


Please Help Members By Posting Answers For Below Questions

Name the sections present in data division.

701


If you are current on the owner of a set, what is the difference between obtain next and obtain first?

644


)If there are 10 steps in GDG, if I want to refer the step2 after step5 . what should I do?

1525


How are the next sentence and continue different from each other?

766


What is the difference between perform … with test after and perform … with test before?

885






When is inspect verb is used in cobol?

679


There are 5 fields and 1000 records in a file. Unload it into an array. Write the syntax for declaration and how will you unload it.

934


I have a File that has duplicate records. I need only those records that occur more than thrice.?

8660


What is the difference between Global and External Variables?

666


explain sorting techniques in cobol program?

692


How do you define a variable of comp-1 and comp-2?

707


how to access the file from prodution from changeman tool and to submit a file to production

6686


How do you reference the following file formats from cobol programs?

696


Which is not true about evaluate statement

1595


Hi pls anybody tell me about " ANALYSIS DOCUMENT PREPARATION AND ESTIMATION OF TASK " (in real time project)."I want to update a sequential file in my project" for that purpose i need both structures i mean analysis document and estimation of task.

1703