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 read the 2nd last record of a VSAM file? (The file size is huge and we don't know the key)
What is the difference between perform … with test after and perform … with test before?
input= ,,,, mainframe training ,,, hyderabad .... location.... output1=$ mainframe training in hyderabad location$ output2=**** mainframe training in hyderabad location ****. In this pgn when we give input considering the spaces the output is displayed in this format.Like in the place of ,,,, $ should be displayed likewise.So please helpmeout.
Name the sections present in data division.
What is the Purpose of Pointer in the string?
Define cobol?
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 Purpose of POINTER Phrase in STRING command in 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.
What is an in line perform? When would you use it? Anything else you wish to say about it.
Name some of the examples of COBOl 11?
What is the difference between PIC 9.99 and PIC9v99?
what is amode(24), amode(31), rmode(24) and rmode(any)?
How to fetch 1000 error records from VSAM file(Eg: 1000000 records present) while getting SOC7 abend ?
What is a scope terminator give example?