Strovent SystemsSign in
Reference

Using a 3270 emulator on IBM i (why F4 prints and F-keys need PA1)

What IBM i does with a 3270 Telnet client, why PF4 prints, how to reach F1 to F24, Field Exit and Reset, and how to change the key map.

IBM i accepts 3270 Telnet clients, but it is a 5250 system underneath. The Telnet server translates the 3270 data stream into 5250, and your session appears to IBM i as a remote 5251 display. The 3270 keyboard has fewer keys than a 5250 keyboard, so IBM i uses a keyboard map that assigns 5250 functions to 3270 keys. That map is why familiar keys seem to do the wrong thing.

The simplest fix is a 5250 (TN5250) session, which IBM names as the preferred emulation. If you have to use 3270, the rest of this page explains the map.

The default key map

  • Help: PF1
  • 3270 Help: PF2
  • Clear: PF3
  • Print: PF4
  • Display embedded attributes: PF5
  • Test Request: PF6
  • Roll Down: PF7
  • Roll Up: PF8
  • Error Reset: PF10 or Enter
  • System Request: PF11
  • Record Backspace: PF12
  • F1 to F12: PA1, then PF1 to PF12
  • F13 to F24: PA2, then PF1 to PF12 (or PF13 to PF24)
  • Field Exit: Erase EOF, then Tab
  • Attention: Attn (3278/3279)

Why F4 prints instead of prompting

On IBM i, F4 is the Prompt key. In the default 3270 map, plain PF4 is Print, so pressing it prints the screen. To send F4, press PA1 and then PF4. The same applies to F3 (Exit), F12 (Cancel) and every other F-key: PA1 first for F1 to F12, PA2 first for F13 to F24.

Know where your emulator puts PA1 and PA2 before you start, because PC and tablet keyboards have no such keys.

Keys that have no 3270 equivalent

IBM lists three 5250 functions that cannot be set on a 3270 keyboard at all:

  • Field Plus
  • Field Minus
  • Erase all input fields

Field Exit works as Erase EOF followed by Tab.

A locked keyboard

When input is inhibited, keys mapped to IBM i functions are ignored. Press Enter or the key mapped to Error Reset (PF10 by default). If you see "A message has arrived on a message queue", press Help or Error Reset, then use DSPMSG to read it.

Seeing and changing the map

  • DSPKBDMAP shows the current map. Option 6 on the Configure TCP/IP Telnet menu shows it too.
  • CHGKBDMAP changes keys on top of the current map. SETKBDMAP starts from the defaults and then applies your changes.
  • Changes last until you run the command again or sign off.

To make a map permanent, an administrator can put the command in a CL program that runs as the user profile's initial program. Running CHGKBDMAP from a session that is not in 3270 mode fails with message CPF8701, so the program can monitor for it and skip the change on 5250 sessions.

Sources

Spotted a mistake? Email [email protected].