Mainframe Data (Field) Types

Need to convert Numeric fields? Request a COBOL quote
That's our business!

This is an overview of the data types commonly found in mainframe files.  The storage of data on a mainframe is quite different than on a PC, and many mainframe data types are not compatible with PC data types.

EBCDIC vs: ASCII: Mainframes use the EBCDIC code set, while PCs use the ASCII codeset.  The codeset refers to how the alphabet is coded internally in the computer. Each letter of the alphabet is represented by a value, and the EBCDIC and ASCII codesets assign different values to the alphabet. For example, the letter A is represented by the hexadecimal (hex) value 41 (65 decimal) in the ASCII codeset, and by the hex value C1 (193 decimal) in the EBCDIC code set. (See EBCDIC and ASCII Character Tables.) 

If all the fields in the mainframe record are of type "character", or "alpha-numeric", meaning the entire file is composed of the letters A-Z, the numbers 0-9, and punctuation (i.e. no binary types), then a simple EBCDIC to ASCII conversion via a translation table will usually work.  But mainframe numbers are often stored in a binary format, and will need conversion for use on a PC.  Some of the most common field types are listed below.

Alpha fields:  Alpha fields are composed of only letters and spaces, with no numbers or punctuation.  See alpha-numeric for more information.

Alpha-Numeric, or Character fields:   These fields are composed of only letters, punctuation, and the numbers 0-9 represented as characters.  Mainframe character fields are in EBCDIC, and can be converted to ASCII for a PC by a simple translation table, without loss of information.

Binary fields:   There are many types of  binary fields.  There are integer fields, floating point fields, bit or coded fields, and other types, either signed or unsigned, in many different forms.  Mainframe binary values are not usually stored the same way as PC binary.  To convert these we need to know the type of binary field, the number of bytes or words, and the byte and word order, among other things.

COBOL Binary fields:   These fields are stored in a pure base 2 binary (machine) format. They are usually 2's-complement format, in 2, 4, or 8 bytes.  See COBOL Computational Fields for more details.

COBOL Comp fields:   These are also binary fields, and the exact type is dependent on both the compiler and the CPU of the computer. We need the same information as for binary fields.  See COBOL Computational Fields for more details.

COBOL Comp-3 fields:   Also called "packed fields", this is a standard COBOL numeric data type that stores ("packs") two digits into each byte.  The last nybble (half byte) is the sign.  This format is almost universally standard across compilers and CPUs.  See COBOL Packed Fields for details.

COBOL Packed Decimal fields:   See COBOL comp-3 fields, above.

IBM Signed fields:   Also called "Zoned", these fields over-punch the sign onto the last (or first) digit of the field.  The rest of the field is numeric (character) data.  These fields should not be converted to ASCII with a translation table because of the sign over punch.  (But if that happens to you, see our Tech Talk brief EBCDIC to ASCII Conversion of Signed Fields.)

Leading Sign numeric fields:   This is the standard numeric data type on a PC.  It is composed of a leading sign, and all the digits are regular characters.  For example,  "-12345", or "+12345", or " 12345".  COBOL "display" fields are also of this type.

Implied Decimal: Implied decimal can apply to any kind of numeric field, and simply means there is a decimal point implied at a specified location, but not actually stored in the file.  For example, the number 123 with an implied decimal of two digits represents the actual value 1.23  Using implied decimal saves space in the file.

Coded fields:  COBOL and other programmers sometimes assign binary codes or bit patterns to a field (usually a 1 byte field).  For example, hex 00 may represent a certain customer status, hex 01 another status, hex 02 another, etc.  Because these are binary codes they need to be converted for most PC applications.


If your mainframe data includes any of these field types other than alpha-numeric, we will need a layout in order to write a program to convert them, and will  need to know what data types to convert each field to.

Our COBOL Conversion Services

Disc Interchange Service Company can convert most numeric data types, including all the IBM mainframe EBCDIC data types, and most ASCII data types from PC and UNIX systems. Our library of conversion routines permits us to handle those difficult jobs that standard COBOL compilers can't convert.
Mainframe & AS/400 Conversions
Mainframe & AS/400 Conversion to PC

With 32 years experience, we are the experts at transferring mainframe data to PCs.
Get more information on IBM Mainframe conversions
Request a COBOL quote

Disc Interchange Service Company, Inc.
15 Stony Brook Road
Westford, MA 01886