The article is served as a quick information about COBOL data types without diving into details how data is organized in code. There are 4 major groups of data types in COBOL: (1) alphabetic, (2) alphanumeric, (3) numeric, and (4) decimal. Numeric and decimal data types can include a sign with values '+' or '-'.
Data Types
COBOL Type | COBOL Representation | Range |
---|---|---|
Signed BINARY 1 byte | PIC S9 to S9(3) COMP | -128 to 128 |
Signed BINARY 2 byte | PIC S9(4) to S9(5) COMP | -32768 to 32767 |
Signed BINARY 4 byte | PIC S9(6) to S9(10) COMP | -2147483648 to 2147483647 |
Signed BINARY 8 byte | PIC S9(11) to S9(19) COMP | -9223372036854775808 to 9223372036854775807 |
Unsigned BINARY 1 byte | PIC 9 to 9(3) COMP | 0 to 255 |
Unsigned BINARY 2 bytes | PIC 9(4) to 9(5) COMP | 0 to 65535 |
Unsigned BINARY 4 bytes | PIC 9(6) to 9(10) COMP | 0 to 4294967295 |
Unsigned BINARY 8 bytes | PIC 9(11) to 9(20) COMP | 0 to 18446744073709551615 |
FLOAT 4 bytes | PIC S9(p)V9(s) COMP-1 | -3.4028235E+38 to -1.1754944E-38, 0.0E+0, +1.1754944E-38 to +3.4028235E+38 |
FLOAT 8 bytes | PIC S9(p)V9(s) COMP-2 | -1.797693134862315E+308 to -2.225073858507201E-308, 0.0E+0, +2.225073858507201E-308 to +1.797693134862315E+308 |
Alpha CHARACTER (A-Z, a-z, and space) | PIC A(n) | N/A |
Any CHARACTER | PIC X(n) | N/A |
Numeric CHARACTER (numbers 0-9) | PIC 9(n) | N/A |
DECIMAL | PIC S9(p)V9(s) COMP-3 | N/A |
DISPLAY NUMERIC | PIC S9(p)V9(s) | N/A |
Resources
- ebcdic-parser tool for converting of mainframe EBCDIC data into Unicode ASCII delimited text
- Data Types and Data Formats
Comments
comments powered by Disqus