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
i want to learn mainframe..any websites and material to learn from basic..? my mail id : rajeswaribe2010@gmail.com
)If there are 10 steps in GDG, if I want to refer the step2 after step5 . what should I do?
In COBOL, what is the different between index and subscript?
how can i see junk values in dclgen or in hostvariable of comp ?
What is the difference between goback, stop run and exit program in cobol?
Which mode is used to operate the sequential file?
how to access the file from prodution from changeman tool and to submit a file to production
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?
1.Is it possible to move the data from 99.99 to 99v99? 2.What is the CICS-vsam Compilation process? 3.In My GDG 5 generation will be there GDG3 got an abend what will happen? 4.In my GDG first generation is +1 And I want to add the new generation what will happen previous generation? 5.How can you give the PIC clause below conditions A). s9 (reddy), B). s9 (5) occurs 5 times? 6.How override the proc from a particular step? and what is symbolic and override Procs?
Define cobol?
What is the difference between PIC 9.99 and PIC9v99?
What are the cobol coding sheets?
Are you comfortable in cobol or jcl?
how to move the records from file to array table. give with code example
I have a File that has duplicate records. I need only those records that occur more than thrice.?