How is sign stored in Packed Decimal fields and Zoned
Decimal fields?
Answer Posted / 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 |
Post New Answer View All Answers
If you are current on the owner of a set, what is the difference between obtain next and obtain first?
Write a program that uses move corresponding.
What are various search techniques in cobol? Explain.
Define cobol?
What is amode(31)
What are 77 levels used for?
What is the difference between a binary search and a sequential search? What are the pertinent cobol commands?
how to move the records from file to array table. give with code example
Explain the configuration section of a cobol program with examples of syntax.
if we have " ibm mainframe ",in that how to remove first and last leading space eg:"ibm mainframe" like that the answer we need
Describe the cobol database components?
) How do u handle errors in BMS macro?
how to access the file from prodution from changeman tool and to submit a file to production
How do you get the data to code the BMS macro?
explain sorting techniques in cobol program?