DateModifiedViewsCategory

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 TypeCOBOL RepresentationRange
Signed BINARY 1 bytePIC S9 to S9(3) COMP-128 to 128
Signed BINARY 2 bytePIC S9(4) to S9(5) COMP-32768 to 32767
Signed BINARY 4 bytePIC S9(6) to S9(10) COMP-2147483648 to 2147483647
Signed BINARY 8 bytePIC S9(11) to S9(19) COMP-9223372036854775808 to 9223372036854775807
Unsigned BINARY 1 bytePIC 9 to 9(3) COMP0 to 255
Unsigned BINARY 2 bytesPIC 9(4) to 9(5) COMP0 to 65535
Unsigned BINARY 4 bytesPIC 9(6) to 9(10) COMP0 to 4294967295
Unsigned BINARY 8 bytesPIC 9(11) to 9(20) COMP0 to 18446744073709551615
FLOAT 4 bytesPIC 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 bytesPIC 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 CHARACTERPIC X(n)N/A
Numeric CHARACTER (numbers 0-9)PIC 9(n)N/A
DECIMALPIC S9(p)V9(s) COMP-3N/A
DISPLAY NUMERICPIC S9(p)V9(s)N/A

Resources


Comments

comments powered by Disqus