First, pick a unique name for your keymap, e.g., mine. Using a text editor such as notepad, create a file called mine.wc3270km in the wc3270 installation directory. (The wc3270 installation directory is usually C:\Program Files\wc3270, but can vary depending on your Windows installation and the options you chose when you installed wc3270.) In that file, put the following:
!description: Map PageUp and PageDown to PF7/PF8 <Key>PRIOR: PF(7) <Key>NEXT: PF(8)
Note that in a keymap file, comment lines start with !. Comment lines are ignored, except for one special one (shown above): a comment line starting with !description: will be displayed by the New Session Wizard as the description of the keymap.
To use the keymap, you can either create a new wc3270 session, or you can modify an existing one.
To create a new one, run the wc3270 New Session Wizard. The list of available keymaps should now include mine.
To modify an existing session, use notepad to edit the session file. (Session files are located in the wc3270 installation directory, and have the suffix .wc3270, so the session file for foo is called foo.wc3270.) If the session already uses a keymap, it will have a line that starts with wc3270.keymap:. If it has this line, modify it to specify mine instead. If it does not have this line, add it:
wc3270.keymap: mine
Now, run your wc3270 session. The Page Up key should now emulate the 3270 PF7 key, and the Page Down key should now emulate the 3270 PF8 key.
[modifier...] <Key> keyname... : action[(args)]...where:
Note that order matters in the keymap. Three important rules apply:
The first rule, combined with the second, means that a default key mapping may interfere with your keymap. For example, if you want to define a mapping for Ctrl-Shift-F1, the default mapping for Shift-F1 (PF13) will override it. The way around this is to use the third rule: define your own mapping for Shift-F1. Your entry will disable the one in the default keymap. But (because of the second rule) be sure to put it after your entry for Ctrl-Shift-F1.
Also note that except for entries that use the Ctrl modifier, mappings are case-sensitive. For example, an entry for Alt-p will not be matched if the Shift key is down or Caps Lock is in effect. To match both Alt-p and Alt-P, there must be two entries in your keymap.
The list of names for special Windows keys, such as PRIOR, NEXT and HOME, is on the wc3270 manual page.
To find out which key or sequence of keys is being generated for any given key on your keyboard, start wc3270 with the -set eventTrace option. wc3270 will create a pop-up window showing a trace file, which will include several lines of text for each key that is pressed. Each entry will include the text for the left-hand side of a keymap entry that will match that key. You can copy and paste the text into a keymap definition. The trace file is x3trc.pid in the current directory.
The second is the show keymap command at the wc3270> prompt, which displays the current keymap. This tells you exactly which keymap entries are active. Often times it will point out that wc3270 isn't using the keymap you thought it was, or that some of your keymap entries are interfering with one another.