Terminal Emulation

A terminal emulator is a piece of software that mimics the functions of a terminal: a box with a screen and keyboard used to connect to a large computer system (a host).

3270s are a family of block-mode terminals used to interact with IBM mainframes. A block-mode terminal allows text to be edited on the screen without interacting with the host. Specific keys cause the updated text to be sent to the host, and the terminal waits for a response with the keyboard locked.

By contrast, a character-mode terminal sends each keystroke to the host for processing. The terminal sends keystrokes and the host sends text to be displayed without any synchronization.

The x3270 family can emulate both a 3270 block-mode terminal and a character-mode terminal.

The emulator communicates with the host using a TCP session over a network. The basic protocol for the session is TELNET.

In addition, the session can be encrypted and authenticated using TLS.

Protocol stack
x3270 is part of a stack of layered protocols. The  green  items are implemented by the x3270 family. Items with a purple background are optional.

Modes
A session can be in one of two basic modes. The current mode can be determined by the ConnectionState query.

NVT mode
All TELNET sessions are initially in Network Virtual Terminal (NVT) mode. In NVT mode, the host sees the session as a pure character-mode terminal. In NVT mode, x3270 emulates an xterm, which is based on the DEC VT100 and VT220 serial terminals. It sends and receives data using UTF-8 encoding.

NVT mode has two sub-modes. The default is line mode, where the terminal collects a line of input until the user presses the Return key, then sends the input to the host. For line mode, various control characters are used to backspace, erase words, etc., and these are all configurable. The host can also negotiate character-at-a-time mode, where each individual keystroke is sent to the host immediately, and it is up to the host to echo them back to the display.

The emulator can be used to communicate with non-IBM hosts using NVT mode. Some IBM hosts also use NVT mode to present an initial menu that is used to select a particular service to connect to.

The interactive emulators indicate NVT mode with an N near the left side of the Operator Information Area at the bottom of the screen.

3270 mode
In 3270 mode, the x3270 family emulates a block-mode 3278 (monochrome) or 3279 (color) terminal. The host must initiate a switch to 3270 mode, using TELNET option negotiation. It either uses TN3270 or TN3270E. The 3270 Data Stream Protocol is used to exchange messages with the host. Text is encoded in EBCDIC, using a configurable host code page.

The interactive emulators indicate 3270 mode with either an A near the left side of the Operator Information Area if TN3270 is in use, or a B if TN3270E is in use.

TN3270E supports an additional sub-mode, SSCP-LU mode. SSCP-LU mode still uses EBCDIC encoding, but the terminal behaves more like NVT line mode, gathering a line of input and forwarding it to the host when the Return key is pressed. SSCP-LU mode is indicated by an S near the left side of the Operator Information Area.

Logical units
Each host session has a logical unit (LU) associated with it. Both TN3270 and TN3270E have provisions for specifying a particular logical unit to connect to. If no logical unit is specified, the host will select a default for the session.