/etc/map3270

database for mapping ASCII keystrokes into IBM 3270 keys

Name:

/etc/map3270

Description:

For IBM-style 3270 terminals to be emulated under QNX, a mapping must be performed between sequences of keys hit on a user's (ASCII) keyboard and the keys available on a 3270. For example, a 3270 has a key labeled EEOF that erases the contents of the current field from the location of the cursor to the end of the field. To accomplish this function, the terminal user and a program emulating a 3270 must agree on what keys will be typed to invoke it.

Format

The map3270 file consists of entries for various keyboards. The first part of an entry lists the names of the keyboards that use that entry. These names will often be the same as in /etc/termcap, but often the terminals from various termcap entries will all use the same map3270 entry. For example, both 925 and 925vb (for 925 with visual bells) would probably use the same entry. Furthermore, when the terminal type defines a window manager, it's necessary to specify a keyboard name (via the TERM environment variable) as the name of the entry.

After the names of the keyboard, which are separated from each other by vertical bars (|), comes a left brace ({), the definitions, and finally, a right brace (}).

Each definition in a keyboard entry consists of a reserved keyword (see 3270 key names below) that identifies the 3270 function. After this keyword comes an equal sign, followed by the various key sequences to generate this particular function, followed by a semicolon. Each key sequence is a string of printable ASCII characters enclosed inside single quotes (except for the first character, which can't be a printable ASCII character); the various alternative sequences are separated by vertical bars. Note that no sequence can be an initial part of another.

Inside the single quotes, a few characters are special. A caret (^) specifies that the next character is the ``control'' character of whatever the character is. So, ^a represents control-a, i.e. hex 1 (note that ^A would generate the same code).

To generate rubout (DEL), you enter ^?. Representing a control character inside a file requires that you use the caret to represent a control sequence - simply typing Ctrl -A won't work. Note that the control-caret sequence (to generate a hex 1E) is represented as:

^^

and not as: ^\^

In addition to the caret, a letter may be preceded by a backslash (\). Since this has little effect for most characters, it's not recommended. For the case of a single quote ('), the backslash prevents that quote from terminating the string. For the case of a caret, the backslash prevents that caret from having its special meaning. To have the backslash be part of the string, it's necessary to place two backslashes (\\) in the file.

The following characters are also special:

This character: Means:
\E An escape character
\n Newline
\t Tab
\r Carriage return

Each character in a string doesn't have to be enclosed within single quotes. For example, \E\E\E means three escape characters.

The \ may also precede the octal representation of a character. This sequence is made up of a set of three characters: the first character can be from 0 to 3, and the next two characters can each be from 0 to 7.

Octal representations need to be defined because QNX generates non-printable byte sequences when certain keys are pressed. For example, the F1 key generates this octal sequence:

377 201

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

3270 keys supported

The following is the list of 3270 key names supported in this file. Note that some of the keys don't really exist on a 3270. The developers of this file have relied extensively on the work at the Yale University Computer Center with their 3270 emulator, which runs in an IBM Series/1 front end. The following list corresponds closely to the functions that the Yale code developers offer in their product.

In the following list, functions marked with an asterisk (*) aren't supported by the tn3270 utility. An unsupported function will cause tn3270 to send a bell sequence to the user's terminal.

3270 key names

3270 key name Functional description
LPRT* Local print
DP Dup character
FM Field mark character
CURSEL Cursor select
CENTSIGN EBCDIC cent sign
RESHOW Redisplay the screen
EINP Erase input
EEOF Erase end of field
DELETE Delete character
INSRT Toggle insert mode
TAB Field tab
BTAB Field back tab
COLTAB Column tab
COLBAK Column back tab
INDENT Indent one tab stop
UNDENT Undent one tab stop
NL Newline
HOME Home the cursor
UP Up cursor
DOWN Down cursor
RIGHT Right cursor
LEFT Left cursor
SETTAB Set a column tab
DELTAB Delete a columntab
SETMRG Set left margin
SETHOM Set home position
CLRTAB Clear all column tabs
APLON* Apl on
APLOFF* Apl off
APLEND* Treat input as ASCII
PCON* Xon/xoff on
PCOFF* Xon/xoff off
DISC Disconnect (suspend)
INIT* New terminal type
ALTK* Alternate keyboard dvorak
FLINP Flush input
ERASE Erase last character
WERASE Erase last word
FERASE Erase field
SYNCH We are in synch with the user
RESET Reset key-unlock keyboard
MASTER_RESET Reset, unlock, and redisplay
XOFF* Please hold output
XON* Please give me output
ESCAPE Enter telnet command mode
WORDTAB Tab to beginning of next word
WORDBACKTAB Tab to beginning of current/last word
WORDEND Tab to end of current/next word
FIELDEND Tab to last nonblank of current/next unprotected (writable) field.
PA1 Program attention 1
PA2 Program attention 2
PA3 Program attention 3
CLEAR Local clear of the 3270 screen
TREQ Test request
ENTER Enter key
PFK1 Program function key 1
PFK2 Program function key 2
... ...
PFK36 Program function key 36

3270 key definitions for the QNX entry

The following table shows the keys for emulating each 3270 function when using the QNX key mapping supplied with the tn3270 utility:

IBM 3270 key Default key
Enter RETURN
Clear Ctrl -Z
New Line Ctrl -N
Tab Tab or Ctrl -I
Back Tab Shift -Tab or Ctrl -B
Cursor Left <-- or Ctrl -<-- or Alt -<--
Cursor Right --> or Ctrl ---> or Alt --->
Cursor Up /\ or Ctrl -/\ or Alt -/\
Cursor Down \/ or Ctrl -\/ or Alt -\/
Delete Char Del or Ctrl -Del or Alt -Del
Erase EOF Ctrl -E
Erase Input Ctrl -W
Insert Mode Ins or Esc space
End Insert Ins or Esc space
PF1 F1
... ...
PF12 F12
PF13 Ctrl -F1
... ...
PF24 Ctrl -F12
PA1 Ctrl -P 1
PA2 Ctrl -P 2
PA3 Ctrl -P 3
Reset After Error Ctrl -T
Purge Input Buffer Ctrl -X
Keyboard Unlock Ctrl -G
Redisplay Screen Ctrl -V
Erase current field Ctrl -_

Caveats:

The tn3270 utility doesn't understand how to process all the functions available in map3270. When you request an unsupported function, tn3270 will beep you.

See also:

tn3270

Greg Minshall, Yale ASCII Terminal Communication System II Program Description/Operator's Manual (IBM SB30-1911)