C H A P T E R  8

Configuring a UNIX Terminal

This chapter provides information about configuring UNIX terminals for use with Sun MTP. It includes the following topics:

IBM 3270 keyboards have keys that control the terminal and generate attention identifiers (AIDs) to the CICS application, controlling the transaction program's execution. Most terminals have function keys that send sequences of multiple characters.

There are several ways to make UNIX terminals act like 3270 devices.


Key Files

Sun MTP supports standard terminals by providing key files for different types of terminals.

If you are using a personal computer with terminal emulator software, select one of the VT emulations from the setup menu so that Sun MTP can run correctly.



Note - If you are using a terminal emulation program, verify that the key sequences generated by the emulator are the same as the key sequences in the Sun MTP key file for that emulator. If you need to redefine keys, most emulation packages allow you to do so through a setup menu. Refer to the documentation for your emulation package for information.



For each terminal type, there is a default keyboard file that has the same file name as the name used in the TERM environment variable, plus the .key suffix. Some terminals support several optional keyboards having different numbers of keys and layouts. For these types of terminals, additional keyboard layouts are defined in files with .key suffixes in the $UNIKIX/lib directory.

Sun MTP automatically locates and loads the default key files. If your terminal does not use the default keyboard, you must explicitly define the keyboard type using the -k option to the unikix command when starting the local client. X term clients usually execute Sun MTP with the TERM environment variable set to xterms.

The following command starts a local client for an NCD 97-key keyboard:

$ unikix -k ncd97.key



Note - The key files are used for UNIX terminals only. They are not used for 3270 SNA device support.



For user convenience, Sun MTP uses some of the keys in the numeric keypad as control keys. Whenever possible, keyboard definitions retain the numeric, add, subtract and decimal point keys on the numeric keypad. When a terminal has insufficient function keys, you can define manually entered multiple key sequences. For example, you can define a back tab function as the two-character sequence Escape, Tab. You can modify the supplied definitions or add new terminal types to suit your specific requirements by modifying the definition of the key files, changing their names, and storing them in the site-specific options directory structure, $UNIKIX/local.

Creating or Editing a Key File Using kixkeydef

Use the kixkeydef utility to create or modify a key file that contains the definitions for your keyboard. You can provide up to five definitions for each key. However, you can only define or edit the first two on the kixkeydef screen. If there are more than two definitions for a key, an asterisk is displayed beside the key definition. To change these definitions or add more definitions, you must edit the key file itself. See Editing a Key File Directly for directions.


procedure icon  To Create or Modify a Key File Using kixkeydef

1. Ensure that the region is not running.

2. Run the kixkeydef utility from a shell prompt to display the kixkeydef screen.

To create a key file called myterm.key in the current directory, type:

$ kixkeydef myterm.key

If you are editing an existing file, the definitions are displayed. If you are creating a new file, a blank screen similar to the one shown in FIGURE 8-1 is displayed. The name of the key file is displayed in the lower right corner of the screen, if you provided one.

  FIGURE 8-1 kixkeydef Screen

Screen shot showing the Key Definition Utility screen, which is displayed when you type the kixkeydef command.[ D ]

3. Move the cursor to the key you want to define.

The following keys move the cursor on the kixkeydef screen:

h: Moves one field to the left

j: Moves down one line

k: Moves up one line

l: Moves one field to the right

4. Press c to indicate a change.

5. Press the key you are defining.

6. Press the Return key to end the change.

7. Repeat Steps 3 through 6 for each key you define.

8. Press w when you are done to write the new key file to disk.

9. Press x to exit the kixkeydef utility.

10. Move the new key file to either $UNIKIX/lib or $UNIKIX/local/lib:

$ mv myterm.key $UNIKIX/lib

11. Restart the local client using the -k option to specify your key file, for example:

$ unikix -k myterm.key


procedure icon  To Define a Return Key, a Linefeed Key, and a Backspace Key

1. On the kixkeydef screen, move the cursor to the desired key location.

2. To define the Return key, press c, type \r, then press Return.

3. Move the cursor to the next desired location.

4. To define the Linefeed key, press c, type \n, then press Return.

5. Move the cursor to the next desired location.

6. To define the Backspace key, press c, type \b, then press Return.

7. To save your changes and exit kixkeydef, press w, then x. To exit without changing the key file, press x.

If you want to change a definition during the editing session, move the cursor to the field and type the new definition. You can also use the Undo (u) or Refresh (r) functions to edit a definition.

If you use the kixkeydef utility to modify a key file that contains comments, the comments are lost when you save the file.

CODE EXAMPLE 8-1 shows a key file generated by the kixkeydef utility.

CODE EXAMPLE 8-1 Key File Generated by kixkeydef Utility
.
#
# Value:  ESC OPHex: 1b 4f 50Octal: 33 117 120
PF1=\EOP
#
# Value:  ESC OQHex: 1b 4f 51Octal: 33 117 121
PF2=\EOQ
#
# Value:  ESC ORHex: 1b 4f 52Octal: 33 117 122
PF3=\EOR
#
# Value:  ESC OSHex: 1b 4f 53Octal: 33 117 123
PA1=\EOS
#
# Value:  ESC [MHex: 1b 5b 4dOctal: 33 133 115
PA2=\EOQ
#
.

Editing a Key File Directly

If you want to create more than two definitions for a key, or you need to modify more than two definitions that were previously created, you must edit the key file directly instead of using the kixkeydef utility. For example, if you are going to define a new key file that supports the COBOL Animator debugger, you must be sure to define the four cursor/arrow keys.

The format of each entry in the key file is illustrated in the following example:

UP=\E[A

The definition starts in column 1. This entry defines the "Cursor up one position" key sequence. The \E represents the ESC character (0x1b in hexadecimal). The sequence of characters that defines the UP function in this example are ESC[A. You can use the special character sequences listed in the following table in the definitions.

TABLE 8-1 Escape Sequences in Keyboard Definitions

Character

Definition

\E

Escape (0x1b)

\b

Backspace (0x8)

\t

Tab (0x9)

\n

Newline (0xa)

\r

Carriage Return (0xd)

\nnn

Octal value (000 to 377).


You can assign a key more than one value. For example, you can define the LEFT key as both \b and \E[D.

You can add comment lines to the file if the line has a pound sign (#) in the first column.

The default file name that contains the terminal's key translations is constructed by using the name of the terminal in the TERM environment variable and appending the .key suffix. The key file must be in the directory $UNIKIX/lib or $UNIKIX/local/lib. The $UNIKIX/local/lib directory is searched first, followed by $UNIKIX/lib. As an alternative, you can use the -k parameter of the unikix command to specify a relative or absolute path name for the file.

The following table lists the keyboard mapping for TERM=xterms with an NCD 101-key keyboard. Appendix A lists the mappings for other supported keyboards.

TABLE 8-2 Keyboard Mapping for TERM=xterms

3270 Function

Characters

Keyboard Legend

UP

\E[A

Up arrow

DOWN

\E[B

Down arrow

LEFT

\E[D

Left arrow

LEFT

\b

Backspace

RIGHT

\E[C

Right arrow

TAB

\t

Tab

BTAB

\E\t

Shift Tab

ERAEOF

\E[6~

Page Down

ERAINP

\E[3~

Page Up

INSMODE

\E[1~

Insert

DEL

\E[4~

Delete

ENTER

\EOM

Enter

CLEAR

\EOk

Keypad add (+)

RESET

\EOm

Keypad subtract (-)

HOME

\E[2~

Home

REFRESH

\014

Ctrl-l (lowercase L)

PF1-PF12

\E[11~ to \E[24~

PF1 to PF12

PA1

\E[OP

Keypad divide (/)

PA2

\E[OQ

Keypad multiply (*)

PA3

\E[OT

Line Feed

PRINT

\E[5~

End


The following table defines the 3270 keyboard functions.

TABLE 8-3 3270 Keyboard Functions

3270 Key

Purpose

AID

UP

Cursor up one position

 

DOWN

Cursor down one position

 

LEFT

Cursor left one position

 

RIGHT

Cursor right one position

 

TAB

Tab to the next unprotected field

 

BTAB

Tab to the previous unprotected field

 

NEWLINE

Cursor to column one, next line

 

HOME

Cursor to line one, column one

 

ERAEOF

Erase to end of field

 

ERAINP

Erase unprotected input (all fields)

 

INSMODE

Toggle insert character mode

 

NOAID

No operation

Yes

DEL

Delete character

 

ENTER

Send message

Yes

CLEAR

Clear screen

Yes

RESET

Reset keyboard lock state

 

PRINT

Print screen

 

REFRESH

Repaint screen

 

PF1-PF24

Program Function keys 1 through 24

Yes

PA1-PA3

Program Attention keys 1 through 3

Yes



Sun MTP X Client Definitions

X resource definitions for keysym translations in the invocation of the xterm terminal emulator tell the xterm VT100 terminal emulator running as the client the correct character sequences to generate for keys located in the application keypad. This is accomplished using the xterm -xrm parameter string.

The following are sample values for the X resources used with the NCD 101-key keyboard:

'XTerm*vt100*translations: #override\
<Key>Insert:          string(0x1b)          string("[1~")\n\
<Key>Home:            string(0x1b)          string("[2~")\n\
<Key>Prior:           string(0x1b)          string("[3~")\n\
<Key>Delete:          string(0x1b)          string("[4~")\n\
<Key>End:             string(0x1b)          string("[5~")\n\
<Key>Next:            string(0x1b)          string("[6~")\n\
<Key>KP_Divide:       string(0x1b)          string("[OP")\n\
<Key>KP_Multiply:     string(0x1b)          string("[OQ")\n\
<Key>KP_Subtract:     string(0x1b)          string("[Om")\n\
<Key>KP_Add:          string(0x1b)          string("[Ok")\n\
<Key>KP_Enter:        string(0x1b)          string("[OM")\n\
<Key>Linefeed:        string(0x1b)          string("[OT")\n\
Shift<Key>Tab:        string(0x1b)          string(0x09)'

The names following <Key> are X keysym values and might not directly reflect the key's legend. An X utility called xev can determine the keysym generated by a key.

Shell scripts containing resource definitions for each supported X server and keyboard combination are located in the $UNIKIX/bin directory. Use these shell scripts to start individual user clients in a new window. For example:

$ xtermunikix unikix

or

$ ncd101unikix unikix

The shell scripts whose names terminate with the suffix start (for example, ncd101start or xtermstart) provide a two-window program development environment. The start shell scripts call the shell scripts with names terminating with unikix. For more information, refer to the Sun Mainframe Transaction Processing Software Reference Guide.

Another level of configuration is available on X servers. This is the ability to map the scan code generated by the keyboard to an X keysym. Normally, this level of tailoring is not required. For more information, refer to the man page for xmodmap(1).


Initializing ASCII Terminals

ASCII terminals are defined in the /etc/inittab file, which is read and acted on by the init process. The following is a sample entry in /etc/inittab:

t0:2:respawn:/etc/getty ttym1 du_1200 none LDISCO

The field none can contain a terminal type; however, the list of terminal types available to getty is limited. Use the tput init command, usually in the .profile or .login file, to initialize the terminal. Refer to the man page entry for inittab(4) for more information about the init process.