PuTTY issues

From The x3270 Wiki

Question

Strange things happen when I use c3270 with PuTTY. For example:

  • Line-drawing characters are wrong (they just seem to be a bunch of q's).
  • PF keys generate garbage on the screen or are simply wrong.

Answer

First, you need to make sure that your TERM environment variable is set correctly. It needs to be putty, not xterm or vt100. That usually takes care of both of the above issues.

There is a more subtle issue with PF keys and PuTTY, however. PuTTY has some odd ideas about function keys. Without the Shift key pressed, F1 generates an escape sequence consistent with F1 in the terminfo definition, and so do F1, F2, etc., all the way to F12.

However, Shift-F1, which should (from a 3270 perspective) generate a sequence for F13, generates a sequence for F10 instead. Shift-F2 generates a sequence for F11, etc., all the way to Shift-F10, which generates a sequence for F19. Shift-F11 generates a sequence for F11, and Shift-F12 generates a sequence for F12. There do not appear to be any keys that generate escape sequences for F20, F21, F22 or F23.

Key Pressed F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12
Resulting sequence without Shift F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12
Resulting sequence with Shift F10 F11 F12 F13 F14 F15 F16 F17 F18 F19 F11 F12

The workaround for this is simple. c3270's default keymap maps the two-key sequence <Ctrl-a, F1> onto PF(13), <Ctrl-a, F2> onto PF(14), etc., all the way to <Ctrl-a, F12> mapping onto PF(24). So if you don't mind a two-key sequence, the problem is solved.