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
I need to compare 3 variables(dates) and do some processing based on the earliest date. There could be more then 1 date record in any of the 3 fields. What is the best way to code this?
How to get the last record in vsam file in cluster? And how can you get the ksds file records into cobol program?
What is the problem of ordered sequential files access?
I have a File that has duplicate records. I need only those records that occur more than thrice.?
What is the Purpose of POINTER Phrase in STRING command in COBOL?
Explain how will you differentiate between an internal and an external sort, the pros and cons, internal sort syntax etc
How to traceback if I am getting SOC7 or SOC4 abend? List down the steps
When is inspect verb is used in cobol?
What is the utilization of copybook in cobol?
Write a cobol program making use of the redefine clause.
can anybody post me about file-aid and changemen tools pls and give me reference if any mainframe guys are there
Why would you use find and get rather than to obtain?
1.give the details about WHEN OTHER. 2. how many form are available in evaluate.
can you please let me know if there is any walkins for COBOL/PLI/DB2/IMS/JCL in pune other than IBM and ITC infotech
) How do u handle errors in BMS macro