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:
\Ean escape character
\nnewline
\ttab
\rcarriage 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 hash mark (#) and terminate at the end of that line. Comments cannot begin inside a quoted string (a hash mark 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, the starred (*) functions 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
DPdup character
FMfield mark character
CURSELcursor select
CENTSIGNEBCDIC cent sign
RESHOWredisplay the screen
EINPerase input
EEOFerase end of field
DELETEdelete character
INSRTtoggle insert mode
TABfield tab
BTABfield back tab
COLTABcolumn tab
COLBAKcolumn back tab
INDENTindent one tab stop
UNDENTundent one tab stop
NLnewline
HOMEhome the cursor
UPup cursor
DOWNdown cursor
RIGHTright cursor
LEFTleft cursor
SETTABset a column tab
DELTABdelete a columntab
SETMRGset left margin
SETHOMset home position
CLRTABclear all column tabs
APLON*apl on
APLOFF*apl off
APLEND*treat input as ASCII
PCON*xon/xoff on
PCOFF*xon/xoff off
DISCdisconnect (suspend)
INIT*new terminal type
ALTK*alternate keyboard dvorak
FLINPflush input
ERASEerase last character
WERASEerase last word
FERASEerase field
SYNCHwe are in synch with the user
RESETreset key-unlock keyboard
MASTER_RESETreset, unlock, and redisplay
XOFF*please hold output
XON*please give me output
ESCAPEenter telnet command mode
WORDTABtab to beginning of next word
WORDBACKTABtab to beginning of current/last word
WORDENDtab to end of current/next word
FIELDENDtab to last nonblank of current/next unprotected (writable) field.
PA1program attention 1
PA2program attention 2
PA3program attention 3
CLEARlocal clear of the 3270 screen
TREQtest request
ENTERenter key
PFK1program function key 1
PFK2program function key 2
.
.
.
.
.
.
PFK36program 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:
EnterRETURN
ClearCtrl-Z
New LineCtrl-N
TabTab or Ctrl-I
Back TabShift-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 CharDel or Ctrl-Del or Alt-Del
Erase EOFCtrl-E
Erase InputCtrl-W
Insert ModeIns or Esc space
End InsertIns or Esc space
PF1F1
.
.
.
.
.
.
PF12F12
PF13Ctrl-F1
.
.
.
.
.
.
PF24Ctrl-F12
PA1Ctrl-P 1
PA2Ctrl-P 2
PA3Ctrl-P 3
Reset After ErrorCtrl-T
Purge Input BufferCtrl-X
Keyboard UnlockCtrl-G
Redisplay ScreenCtrl-V
Erase current fieldCtrl-_

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)