How is sign stored in Packed Decimal fields and Zoned
Decimal fields?
Answers were Sorted based on User's Feedback
Answer / kavi
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.
| Is This Answer Correct ? | 18 Yes | 2 No |
Answer / escapa
In both sign is stored at last byte but
In PACKED Decimal is at last nibble where as in ZONED decimal sign is stored at higher nibble of last byte
Eg.
+1234 in zoned decimal it will be stored as F1 F2 F3 C4
-1234 in zoned decimal it will be stored as F1 F2 F3 D4
+1234 in PACKED decimal it will be stored as 01 23 4C
-1234 in PACKED decimal it will be stored as 01 23 4D
| Is This Answer Correct ? | 12 Yes | 4 No |
Answer / dinesh kumar gaddam
Packed Decimal fields (COMP-3):
the sign is stored in the last nibble (4 bits).
If sign S is not used then last nibble will contain X'F'.
If sign S is used and value is positive then it will contain X'C'
if sign S is used and value is negative then it will contain X'D'
Example:
PIC S9(04) COMP-3 VALUE 2345. -> X’02345C’
PIC S9(04) COMP-3 VALUE -2345. -> X’02345D’
PIC 9(04) COMP-3 VALUE 2345. -> X’02345F’
Zoned Decimal fields (DISPLAY):
The data is stored in zoned decimal as:
1 is represented as X’F1’
2 is represented as X’F2’ etc.
If the data is declared as signed S then sign is over punched with numeric value of last byte in zoned decimal.
If the value is positive then last bytes first nibble will be X’C’ instead of X’F’ and if the value is negative then last bytes first nibble will be X’D’ instead of X’F’.
Example:
PIC 9(04) VALUE 1234. -> X’F1F2F3F4’
PIC S9(04) VALUE -1234. -> X’F1F2F3D4’
PIC S9(04) VALUE 1234. -> X’F1F2F3C4’
| Is This Answer Correct ? | 6 Yes | 1 No |
Answer / pradeep
For a Packed decimal:
(a) positive value is stored as,
0653
000F
Here, the value 'F' specifies its a +ve value. Also, 'C' is
also used to store +ve values.
(b) negative value is stored with 'D' instead of 'F'
| Is This Answer Correct ? | 10 Yes | 7 No |
Answer / purushothr
sign ll stored in
packed decimal: last bit(comp3)
zoned decimal field: most significan bit(comp)
| Is This Answer Correct ? | 3 Yes | 2 No |
Answer / 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 |
what is the result of the following? DIVIDE A INTO B GIVING C. a.C=A/B b.the reminder of B/A is stored in C c.C=B/A d.the reminder of A/B is stored in C
i have two file one is ksds another one is esds i want store matching records in flat file how to you matching.
At the minimum, which division of COBOL is enough to be coded?
s9(18) comp-3:: What is the size of memory it takes internally?
what is the meaning of pic 9(09)v99-
What are all the divisions of a COBOL program?
Hi Devolopers.. i need ur help.. i have 3 years of exp in Manual testing and SQL, next month onwards i shifted in to MAINFRAME TESTING... i have ZERO Knowledge abt mainframes.... PLS SUGGEST ME WHAT I LEARN in AMEERPET? mainframe testing or mainframe total devolopment subject... AS a devoloper u know every thing tester what to do PLSSSSSSSSS help me ITS VERY URGENT...
How do u initialize an array?
01 MOVE 10 TO N 05 PERFOM PARA1 TIMES STOP RUN WAT WILL HAPPEN?? WILL IT RUN INFINITELY OR AN ERROR WIL BE THER BECAUSE NO OF TIMES IS NOT GIVEN??
Can you REWRITE a record in an ESDS file? Can you DELETE a record from it?
6 Answers ABC, IBM, Mphasis, Wipro,
What is reference modification? What is UNION in sql and syntax? What is the difference between GDGS and VSAM? Which is prefer one? What is processing groups in endevor?
What is 66 level number and where it is used in real time by software developers?
2 Answers ITC Indian Tobacco Company, TCS,