map3270 File Format for TCP/IP

Purpose

Defines keyboard mapping and colors for the tn3270 command.

Description

The /etc/map3270 file defines keyboard mapping and colors for the tn3270 command. When emulating 3270 terminals, mapping must be performed between key sequences entered on a user's (ASCII) keyboard and the keys that are available on a 3270 emulator.

For example, the 3270 emulator key EEOF erases the contents of the current field from the location of the cursor to the end of the field. In order to accomplish this function, the terminal user and a program emulating a 3270 emulator must be compatible with regard to what keys invoke the EEOF function.

The requirements for these sequences are:

The /etc/map3270 file consists of entries for various terminals. The first part of an entry lists names of terminals using that entry. These names should be the same as those in the /usr/share/lib/terminfo/*.ti files.
Note: Often, several terminals from different /usr/share/lib/terminfo/*.ti entries use the same /etc/map3270 file entry. For example, both 925 and 925vb (for 925 with visual bells) might use the same map3270 file entry. Each name is separated by a | (vertical bar), after which comes a { (left brace); the definitions; and finally, a } (right brace).

Format

The definitions begin with a reserved keyword, which identifies the 3270 function. The keyword is followed by an = (equal sign), which in turn is followed by the various string sequences to generate the particular function. The definitions end with a ; (semi-colon). The string sequences are printable ASCII characters enclosed inside ' ' (single quotes) and separated by | (vertical bars).

Special characters can be used within ' ' (single quotes). A ^ (caret) indicates a control character. For example, the string '^a' represents Ctrl-A; that is, hexadecimal 1 (the string '^A' generates the same code). To generate delete or rubout, enter '^d' '^?' (Ctrl-D or Ctrl-?). To represent a control character in the /etc/map3270 file, you must use the caret. Typing Control-A or Ctrl-A does not work.
Note: The Ctrl-^ key sequence (to generate a hexadecimal 1E) is represented as '^^' (not '^\^').

The \ (backslash) special character precedes other characters to change their meaning. Because this has little effect for most characters, its use is not recommended. The backslash prevents a single quote from terminating a string, for example the string '^\'' represents Ctrl-'. For a backslash to be part of a string, place two backslashes ('\\') in the string.

In addition, the following characters are special:

'\e'   Specifies an escape character.
'\n'   Specifies a new line.
'\t'   Specifies a tab.
'\r'   Specifies a carriage return.

It is not necessary for each character in a string to be enclosed within single quotes. The string '\e\e\e' means three escape characters.

Comments, which may appear anywhere on a line, begin with a # (pound sign) and terminate at the end of that line. However, comments cannot begin inside a quoted string. A pound sign inside a quoted string has no special meaning.

3270 Keys Supported

Note: Some of the following keys do not exist on a 3270 emulator. The functions listed with an * (asterisk) are not supported by the tn3270 command. An unsupported function causes the tn3270 command to send a bell sequence to the user's terminal.

The /etc/map3270 file supports the following list of 3270 key names:

Key Name Functional Description
altk* Alternate keyboard dvorak
aplend* Treat input as ASCII
aploff* APL off
aplon* APL on
attention Attention key. The attention key sends an IAC BREAK TELNET protocol sequence to the TELNET server on a VM or MVS™ system. The TELNET server is responsible for implementing the attention key.
btab Field tab back
clear Local clear of the 3270 screen
clrtab Clear all column tabs
colbak Column back tab
coltab Column tab
cursel* Cursor select
delete Delete character
deltab Delete a column tab
disc Disconnect (suspend)
down Down cursor
dp Duplicate character
eeof Erase end of field
einp Erase input
enter Enter key
erase Erase last character
escape Enter TELNET command mode
ferase Erase field
fieldend Tab to last non-blank of current or next unprotected (writable) field
flinp Flush input
fm Field mark character
home Home the cursor
indent Indent one tab stop
init* New terminal type
insrt Toggle insert mode
Item Description
left Left cursor
lprt* Local print
master_reset Reset, unlock, and redisplay
nl New line
pa1 Program attention 1
pa2 Program attention 2
pa3 Program attention 3
pfk1 Program function key 1
pfk2 Program function key 2
. .
. .
. .
pfk36 Program function key 36.
pcoff* Xon/xoff off
pcon* Xon/xoff on
reset Reset key-unlock keyboard
reshow Redisplay the screen
right Right cursor
sethom Set home position
setmrg Set left margin
settab Set a column tab
synch In synch with the user
tab Field tab
treq Test request
undent Undent one tab stop
up Up cursor
werase Erase last word
wordbacktab Tab to beginning of current or last word
wordend Tab to end of current or next word
wordtab Tab to beginning of next word
xoff* Hold output
xon* Release output

A Sample Entry

The following default entry is included within the tn3270 command and is used when it is unable to locate a version in the user's environment or the /etc/map3270 file.

name {                       # actual name comes from TERM variable
clear = '^z';
flinp = '^x';
enter = '^m';
delete = '^d' | '^?';        # note that '^?' is delete (rubout)
synch = '^r';
reshow = '^v';
eeof = '^e';
tab = '^i';
btab = '^b';
    
nl = '^n';
left = '^h';
right = '^l';
up = '^k';
down = '^j';
einp = '^w';
reset = '^t';
xoff = '^s';
xon = '^q';
escape = '^c';
ferase = '^u';
insrt = ' ';
# program attention keys
pa1 = '^p1'; pa2 = '^p2'; pa3 = '^p3';
# program function keys
pfk1 = '1'; pfk2 = '2'; pfk3 = '3'; pfk4 = '4';
pfk5 = '5'; pfk6 = '6'; pfk7 = '7'; pfk8 = '8';
pfk9 = '9'; pfk10 = '  '; pfk11 = '-'; pfk12 = '=';
pfk13 = ''; pfk14 = '@'; pfk15 = '0;
pfk17 = ''; pfk18 = ''; pfk19 = ''; pfk20 = ';
pfk21 = ' pfk22 = ')'; pfk23 = '_'; pfk24 = ' ';
}

3270 Key Definitions

The following table shows the proper keys to emulate each 3270 function when using the default key mapping supplied with the tn3270 command.

Table 1. 3270 Key Definitions
Function 3270 Key Default Key(s)
Command Keys Enter RETURN
  Clear Ctrl-z
  Attention Ctrl-F12
Cursor Movement Keys New line Ctrl-n or Home
  Tab Ctrl-i
  Back tab Ctrl-b
  Cursor left Ctrl-h
  Cursor right Ctrl-l
  Cursor up Ctrl-k
  Cursor down Ctrl-j or LINE FEED
Edit Control Keys Delete char Ctrl-d or RUB
  Erase EOF Ctrl-e
  Erase input Ctrl-w
  Insert mode ESC Space
  End insert ESC Space
Item Description
Program Function Keys PF1 ESC 1
  PF2 ESC 2
  ... ...
  PF10 ESC 0
  PF11 ESC -
  PF12 ESC =
  PF13 ESC !
  PF14 ESC @
  ... ...
  PF24 ESC +
Program Attention Keys PA1 Ctrl-p 1
  PA2 Ctrl-p 2
  PA3 Ctrl-p 3
Local Control Keys Reset after error Ctrl-r
  Purge input buffer Ctrl-x
  Keyboard unlock Ctrl-t
  Redisplay screen Ctrl-v
Other Keys Erase current field Ctrl-u

Files

Item Description
/etc/3270.keys Contains the default keyboard mapping.
/usr/share/lib/terminfo/*.ti Files containing terminal information.