This is a discussion of COBOL Computational fields. Several binary option double up data types are discussed, including the common “packed” and “comp-3” fields. By default, numeric values in COBOL files are stored in “display”, or character, format, in the same way the letters of the alphabet are stored. 8, 16, 32, or 64 bits.
The computer is more efficient when working in its native register size. The minimum unit of computation on some machines is 16 bits, so the smallest size of a binary value on many machines is 2 bytes. But others can use 1 byte. Sometimes this is a compiler option. Most binary values are stored in either 2, 4, or 8 bytes. Some COBOL compilers only permit these multiples, while others permit one byte increments: 1, 2, 3, 4, 5, 6, 7, or 8 bytes.
Many vendors use the IEEE floating point standards, but others, notably IBM, don’t. Most pure binary integers use 2’s-complement, but each vendor is free to chose his own method for all types. Some compilers have comp-4 and comp-5 data types, usually to emulate a comp type of another system, like an IBM mainframe. There are other COBOL binary data types, such as index and pointer, but they are used internally in the program, and are not found in files, so are not of concern to us.
Comp-3 is so common and so uniform across platforms that we have written a separate Tech Talk brief for it. The number of bits, bytes, or words that are stored for any given field usually depends on the number of digits given in the COBOL PIC. So a PIC 9 or PIC 99 would require 1 byte, but a PIC 999 would require 2 bytes. DISC can convert most COBOL numeric data types, including all the IBM mainframe EBCDIC data types.
Our library of conversion routines permits us to handle those difficult jobs that standard COBOL compilers can’t convert. With over 32 years of experience with thousands of files, we have the knowledge to catch problems with the data before they cause you grief. With 32 years experience, we are the experts at transferring mainframe data to PCs. A binary prefix is a unit prefix for multiples of units in data processing, data transmission, and digital information, notably the bit and the byte, to indicate multiplication by a power of 2. The computer industry has historically used the units kilobyte, megabyte, and gigabyte, and the corresponding symbols KB, MB, and GB, in at least two slightly different measurement systems. In most other contexts, the industry uses the multipliers kilo, mega, giga, etc. The use of the same unit prefixes with two different meanings has caused confusion.