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
How to find out the closest prime number of an input number? I believe it has something to do with SEARCH and COBOL Linear Array.
i want a program using by if, evaluate , string, unstring, perform, occurs?
How to fetch 1000 error records from VSAM file(Eg: 1000000 records present) while getting SOC7 abend ?
Define cobol?
Program A (Normal COBBAT) calling a B Program (DB2COBOL, COBBATDB which is using a VSAM file. its a dynamic call. How we will handle VSAM file decleration in our from JCL from where we are running A PGM. And should we have PLAN for A pGM also. if possible can some one post a sample JCL. Thanks for help in advance.
how to access the file from prodution from changeman tool and to submit a file to production
Why would you use find and get rather than to obtain?
What is the difference between a binary search and a sequential search what are the pertinent cobol?
how do you reference the esds vsam file formats from cobol programs
Differentiate between structured cobol programming and object-oriented cobol programming.
What is the local-storage section?
How to traceback if I am getting SOC7 or SOC4 abend? List down the steps
Which mode is used to operate the sequential file?
How many bytes S(8) comp field occupy and its maximum value?
how do you reference the printer file formats from cobol programs