EBCDIC


Extended Binary Coded Decimal Interchange Code is an eight-bit character encoding used mainly on IBM mainframe and IBM midrange computer operating systems. It descended from the code used with punched cards and the corresponding six-bit binary-coded decimal code used with most of IBM's computer peripherals of the late 1950s and early 1960s. It is supported by various non-IBM platforms, such as Fujitsu-Siemens' BS2000/OSD, OS-IV, MSP, and MSP-EX, the SDS Sigma series, Unisys VS/9, Unisys MCP and ICL VME.

History

EBCDIC was devised in 1963 and 1964 by IBM and was announced with the release of the IBM System/360 line of mainframe computers. It is an eight-bit character encoding, developed separately from the seven-bit ASCII encoding scheme. It was created to extend the existing Binary-Coded Decimal Interchange Code, or BCDIC, which itself was devised as an efficient means of encoding the two zone and number punches on punched cards into six bits. The distinct encoding of 's' and 'S' was maintained from punched cards where it was desirable not to have hole punches too close to each other to ensure the integrity of the physical card.
While IBM was a chief proponent of the ASCII standardization committee, the company did not have time to prepare ASCII peripherals to ship with its System/360 computers, so the company settled on EBCDIC. The System/360 became wildly successful, together with clones such as RCA Spectra 70, ICL System 4, and Fujitsu FACOM, thus so did EBCDIC.
All IBM's mainframe operating systems, and its IBM i operating system for midrange computers, use EBCDIC as their inherent encoding. Software can translate to and from encodings, and modern mainframes include processor instructions, at the hardware level, to accelerate translation between character sets. Modern z/OS compilers for the C and C++ languages on IBM Z mainframes, and earlier OS/390 C and C++ compilers on IBM System/390 mainframes, support a POSIX-compatible execution environment that makes use of ASCII by default.
Not all operating systems running on IBM hardware use EBCDIC; IBM AIX, Linux on IBM Z, and Linux on Power all use ASCII, as do all operating systems that run on the IBM Personal Computer and its successors.

Compatibility with ASCII

There were numerous difficulties to writing software that would work in both ASCII and EBCDIC.
  • The gaps between letters made simple code that worked in ASCII fail on EBCDIC. For example would print the alphabet from A to Z if ASCII is used, but print 41 characters in EBCDIC.
  • Sorting EBCDIC put lowercase letters before uppercase letters and letters before numbers, exactly the opposite of ASCII.
  • Most programming languages and file formats and network protocols designed for ASCII used available punctuation marks that did not exist in EBCDIC, making translation to EBCDIC systems difficult. Workarounds such as trigraphs |trigraphs] were used. Conversely EBCDIC had some characters such as logical not, that were used on IBM systems and could not be translated to ASCII. The logical not character is used in the PL/I programming language, and some other IBM languages.
  • The EBCDIC character NL was best treated as the ASCII LF, but as EBCDIC also contains a character called LF this was not always done consistently.
  • If seven-bit ASCII was used, there was an "unused" high bit in 8-bit bytes, and many pieces of software stored other information there. Software would also pack the seven bits and discard the eighth, such as packing five seven-bit ASCII characters in a 36-bit word. On the PDP-11, bytes with the high bit set were treated as negative numbers, behavior that was copied to C, causing unexpected problems if the high bit was set. These all made it difficult to switch from ASCII to the 8-bit EBCDIC.

    Code page layout

There are hundreds of EBCDIC code pages based on the original EBCDIC character encoding; there are a variety of EBCDIC code pages intended for use in different parts of the world, including code pages for non-Latin scripts such as Chinese, Japanese, Korean, and Greek. There is also a huge number of variations with the letters swapped around for no discernible reason.
The table below shows the "invariant subset" of EBCDIC, which are characters that should have the same assignments on all EBCDIC code pages that use the Latin alphabet. It also shows missing ASCII and EBCDIC punctuation, located where they are in Code Page 37. The blank cells are filled with region-specific characters in the variants, but the characters in gray are often swapped around or replaced as well. Like ASCII, the invariant subset works only for languages using only the ISO basic Latin alphabet, such as English.

Definitions of non-ASCII EBCDIC controls

Following are the definitions of EBCDIC control characters which either do not map onto the ASCII control characters, or have additional uses. When mapped to Unicode, these are mostly mapped to C1 control character codepoints in a manner specified by IBM's Character Data Representation Architecture.
Although the default mapping of New Line corresponds to the ISO/IEC 6429 Next Line character, most of these C1-mapped controls match neither those in the ISO/IEC 6429 C1 set, nor those in other registered C1 control sets such as ISO 6630. Although this effectively makes the non-ASCII EBCDIC controls a unique C1 control set, they are not among the C1 control sets registered in the ISO-IR registry, meaning that they do not have an assigned control set designation sequence.
Besides U+0085, the Unicode Standard does not prescribe an interpretation of C1 control characters, leaving their interpretation to higher level protocols, so this mapping is permissible in, but not specified by, Unicode.
MnemonicEBCDICCDRA pairingNameDescription
SEL04009CSelectDevice control character taking a single-byte parameter.
PF04009CPunch OffListed in this location by GOST 19768-93.
RNL060086Required New LineLine-break resetting mode
LC060086Lower CaseListed in this location by GOST 19768-93.
GE080097Graphic EscapeNon-locking shift that changes the interpretation of the following character. Compare ISO/IEC 6429's .
SPS09008DSuperscriptBegin superscript or undo subscript. Compare ISO/IEC 6429's .
RPT0A008ERepeatSwitch to an operation mode repeating a print buffer
SMM0A008EStart of Manual MessageListed in this location by GOST 19768-93.
RES/ENP14009DRestore, Enable PresentationResume output
NL150085 New LineLine break. Default mapping matches ISO/IEC 6429's. Mappings sometimes swapped with Line Feed in accordance with UNIX line breaking convention.
POC170087Program Operator CommunicationFollowed by two one-byte operators that identify the specific function, for example a light or function key. Contrast with ISO/IEC 6429's , and .
IL170087IdleListed in this location by GOST 19768-93.
UBS1A0092Unit BackspaceA fractional backspace.
CC1A0092Cursor ControlListed in this location by GOST 19768-93.
CU11B008FCustomer Use OneNot used by IBM; for customer use.
IUS/ITB1F001FInterchange Unit Separator, Intermediate Transmission BlockEither used as an information separator to terminate a block called a "unit", or used as a transmission control code to delimit the end of an intermediate block.
DS200080Digit SelectUsed by S/360 CPU edit instruction
SOS210081Start of SignificanceUsed by S/360 CPU edit instruction.
FS, FDS220082Field SeparatorUsed by S/360 CPU edit instruction.
WUS230083Word UnderscoreUnderscores the immediately preceding word. Contrast with ISO/IEC 6429's SGR.
BYP/INP240084Bypass, Inhibit PresentationDe-activates output, i.e. ignores all graphical characters and control characters besides transmission control codes and RES/ENP, until the next.
SA280088Set AttributeMarks the beginning of a fixed-length device specific control sequence. Deprecated in favour of.
SFE290089Start Field ExtendedMarks the beginning of a variable-length device specific control sequence. Deprecated in favour of.
SM/SW2A008ASet Mode, SwitchDevice specific control that sets a mode of operation, such as a buffer switch.
CU22B008BCustomer Use TwoThis appears in some specifications, such as GOST 19768-93; newer IBM specifications for EBCDIC control codes list only CU1 and CU3 as customer-use, and use this position for.
CSP2B008BControl Sequence PrefixMarks the beginning of a variable-length device specific control sequence. Followed by a class byte specifying a category of control function, a count byte giving the sequence length, a type byte identifying a control function within that category, and zero or more parameter bytes. Contrast with ISO/IEC 6429's and .
MFA2C008CModify Field AttributeMarks the beginning of a variable-length device specific control sequence. Deprecated in favour of.
300090'Reserved for future use by IBM
310091'Reserved for future use by IBM
IR330093Index ReturnEither move to start of next line, or terminate an information unit.
PP340094Presentation PositionFollowed by two one-byte parameters to set the current position. Contrast with ISO/IEC 6429's CUP and HVP.
PN340094Punch OnListed in this location by GOST 19768-93.
TRN350095TransparentFollowed by one byte parameter that indicates the number of bytes of transparent data that follow.
RST350095Reader StopListed in this location by GOST 19768-93.
NBS360096Numeric BackspaceMove backward the width of one digit.
UC360096Upper CaseListed in this location by GOST 19768-93.
SBS380098SubscriptBegin subscript or undo superscript. Compare ISO/IEC 6429's .
IT390099Indent TabIndents the current and all following lines, until or is encountered.
RFF3A009ARequired Form FeedPage-break resetting mode.
CU33B009BCustomer Use ThreeNot used by IBM; for customer use.
3E009EReserved for future use by IBM
EOFF009FEight OnesAll ones character used as filler

Code pages with Latin-1 character sets

The following code pages have the full Latin-1 character set. The first column gives the original code page number. The second column gives the number of the code page updated with the euro sign replacing the universal currency sign
Different countries have different code pages because these code pages originated as code pages with country-specific character repertoires, and were later expanded to contain the entire ISO 8859-1 repertoire, meaning that a given ISO 8859-1 character may have different code point values in different code pages. They are known as Country Extended Code Pages.
CCSIDEuro
update
Countries
0371140Australia, Brazil, Canada, New Zealand, Portugal, South Africa, USA
2731141Austria, Germany
2771142Denmark, Norway
2781143Finland, Sweden
2801144Italy
2841145Latin America, Spain
2851146Ireland, United Kingdom
2971147France
5001148International
8711149Iceland
1047924Open Systems

Criticism and humor

advocate and software developer Eric S. Raymond writes in his Jargon File that EBCDIC was loathed by hackers, by which he meant members of a subculture of enthusiastic programmers. What is known as vendor lock-in today, is jokingly criticized in The Jargon File with the following definition:
EBCDIC design was the source of many jokes. One such joke, found in the Unix fortune file of 4.3BSD Reno went:
References to the EBCDIC character set are made in the 1979 computer game series Zork. In the "Machine Room" in Zork II, EBCDIC is used to imply an incomprehensible language:
In 2021, it became public that a Belgian bank was still using EBCDIC internally in 2019. A customer insisted that the correct spelling of his surname included an umlaut, which the bank omitted, and the customer filed a complaint citing the guarantee in the General [Data Protection Regulation] of the right to timely "rectification of inaccurate personal data." The bank's argument included the fact that their system used EBCDIC, as well as that it did not support letters with diacritics. The appeals court ruled in favor of the customer.