EBCDIC
EBCDIC (Extended Binary Coded Decimal Interchange Code) is the character encoding used by 3270 terminals. It is an 8-bit encoding, originally based on the arrangement of holes in punched cards. Unlike Unicode and its predecessor ASCII, the letters of the Latin alphabet are not contiguous in EBCDIC.
The precise mapping between EBCDIC and other encodings depends on the host code page.
The x3270 family uses EBCDIC when communicating with the host, and stores EBCDIC codes in the virtual display buffer, but uses Unicode internally, translating as necessary.
Notation
Mainframe documentation generally uses the notation X'nn' to refer to an EBCDIC value in hexadecimal, rather than the more typical 0xnn.
Special EBCDIC charaters
NUL
The EBCDIC NUL character, value X'00', is a control character used to represent no data. It is displayed as a blank, and thus can be confused with the space character, X'40'.
When the 3270 display is switched to visible control character mode, NULs can be distinguished from spaces.
3270 terminals can do some counter-intuitive things when there are NUL characters on the screen. For example, if a printing character is placed in a field to the right of a NUL, when the screen is sent to the host, the host will remove the NUL, even though the user probably thought it was a space. Conversely, a 3270 will allow a character to be inserted into a field (with the remaining characters shifted to the right) only if the rightmost character in the field is a NUL. If the rightmost character is a space, the terminal keyboard will lock instead. The blankFill resource is used to override these behaviors.
SO and SI
The Shift Out (SO, X'0E') and Shift Out (SI, X'0F') characters are used to distinguish groups of DBCS characters within a mixed SBCS/DBCS field. The SO signals a shift from SBCS to DBCS; the SI signals a shift back from DBCS to Host code page#Character sets||SBCS]].
SO and SI are also displayed as blanks unless visible control character mode is enabled.
Here is an example of a field containing the text Mixed 中 mode
while using host code page 935:
EBCDIC (hex) | D4 | 89 | A7 | 85 | 84 | 0E | 5B | CF | 0F | 94 | 96 | 84 | 85 |
Display | M |
i |
x |
e |
d |
中 |
m |
o |
d |
e
|
DUP and Field Mark
DUP (X'1C') and Field Mark (X'1E') are relatively obscure control characters with roots going back to punched cards.
See also
Wikipedia article on EBCDIC [1]