DateModifiedViewsCategory

Decimal data type is called packed because it stores two digits in each byte. An exception is low-order byte which contains one digit in the leftmost portion and the sign (positive or negative) in the rightmost portion. Positive numbers are represented by hexadecimal F and negative numbers by hexadecimal D.

It requests less storage than binary or display numeric types. The summary of decimal data type can be found in COBOL Data Types article.

Storage Description

Byte 3Byte 2Byte 1
Digit-DigitDigit-DigitDigit-Sign

Sample 1

35,791 value

Byte 3Byte 2Byte 1
0011-01010111-10010001-1111

Sample 2

-35,791 value

Byte 3Byte 2Byte 1
0011-01010111-10010001-1101

COBOL Representation Samples

01 VAR-PK-DECIMAL PIC 9(5) USAGE COMP-3.
01 VAR-PK-DECIMAL PIC 9(05) USAGE COMP-3.
01 VAR-PK-DECIMAL PIC 9(5) COMP-3.
01 VAR-PK-DECIMAL PIC S9(5) USAGE COMP-3.
01 VAR-PK-DECIMAL PIC 9(5)V9(2) USAGE COMP-3.
01 VAR-PK-DECIMAL PIC 9(5)V9(2) COMP-3.
01 VAR-PK-DECIMAL PIC S9(5)V9(2) COMP-3.

Resources

  • ebcdic-parser tool for converting of mainframe EBCDIC data into Unicode ASCII delimited text

Comments

comments powered by Disqus