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 your wc3270 documents directory (My Documents\wc3270 -- where where the Session Wizard saves session files).
In that file, put the following, using a text editing program like Notepad:
!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 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. In either case, run the Session Wizard. The list of available keymaps should now include mine.
Tell the Session Wizard to change the keymap and rewrite the session file.
Now, run your wc3270 session again. 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 (VKeys), such as PRIOR, NEXT and HOME, is on the wc3270 manual page.
wc3270 will also accept the syntax VKEY-0xnn, where nn is a hexadecimal number between 01 and fe (254). For example, the PRIOR key is VKey 0x21. wc3270 will accept VKEY-0x21 as an alias for PRIOR.
To find out which key or sequence of keys is being generated for any given key on your keyboard, start wc3270 with the -trace 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 on your desktop.
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.
Keymap resource definitions go at the very end of a wc3270 session file. The above example would look like this:
Note that wc3270 resource definitions use backslash quoting conventions, so a backslash ('\') inside a keymap must be quoted with another backslash. Also, keymaps are multi-line resource definitions, so each line except the last must end with a newline ('\n') and a backslash ('\'), as shown above.! Note that in this file, backslash ('\') characters are used to specify ! escape sequences, such as '\r' for a Carriage Return character or '\t' ! for a Tab character. To include literal backslashes in this file, such as ! in Windows pathnames or UNC paths, they must be doubled, for example: ! ! Desired text Must be specified this way ! C:\xdir\file C:\\xdir\\file ! \\server\printer \\\\server\\printer ! !*Additional resource definitions can go after this line. ! Define my meymap. wc3270.keymap.mine: \n\ <Key>PRIOR: PF(7) \n\ <Key>Next: PF(8) \n ! Select my keymap. wc3270.keymap: mine
Note that similar naming conventions are used to define the mode-specific keymap resources are are used to name the files: the wc3270.keymap.foo resource would define the mappings that are used in all modes; the wc3270.keymap.mine.nvt resource would define the mappings that apply only to NVT mode, and the wc3270.keymap.mine.3270 resource would define the mappings that apply only to 3270 mode. The one, two or three keymap resources above are taken together to define a single keymap, mine.