Display decimal data type another name is zoned decimal. Each byte is separated into 2 parts. The first 4 bits is a zone and the second 4 bits is a value, thus one byte can contain only one digit. The low byte zone includes a sign. Positive numbers are represented by hexadecimal F and negative numbers by hexadecimal D. The summary of decimal data type can be found in COBOL Data Types article.
Storage Description
Byte 5 | Byte 4 | Byte 3 | Byte 2 | Byte 1 |
---|---|---|---|---|
Zone-Digit | Zone-Digit | Zone-Digit | Zone-Digit | Sign-Digit |
Sample 1
35,791 value
Byte 5 | Byte 4 | Byte 3 | Byte 2 | Byte 1 |
---|---|---|---|---|
1111-0011 | 1111-0101 | 1111-0111 | 1111-1001 | 1111-0001 |
Sample 2
-35,791 value
Byte 5 | Byte 4 | Byte 3 | Byte 2 | Byte 1 |
---|---|---|---|---|
1111-0011 | 1111-0101 | 1111-0111 | 1111-1001 | 1101-0001 |
COBOL Representation
Generic Formula
USAGE DISPLAY SIGN [IS] {TRAILING | LEADING} [SEPARATE [CHARACTER]]
Samples
05 VAR-ZN-DECIMAL PIC 9(5).
05 VAR-ZN-DECIMAL PIC 9(5)V9(2) DISPLAY.
05 VAR-ZN-DECIMAL PIC 9(5) USAGE DISPLAY.
05 VAR-ZN-DECIMAL PIC 9(5)V9(2) USAGE DISPLAY.
05 VAR-ZN-DECIMAL PIC 9(5) USAGE DISPLAY SIGN TRAILING SEPARATE.
05 VAR-ZN-DECIMAL PIC S9(5).
05 VAR-ZN-DECIMAL PIC S9(5)V9(3) DISPLAY.
Resources
- ebcdic-parser tool for converting of mainframe EBCDIC data into Unicode ASCII delimited text
Comments
comments powered by Disqus