I have solved my problem.
First, I will reply to the two suggestions above.
linosaurusroot - the key mappings won't be much use. When I press left and right arrow, it generates some key codes, I do not know what, and they are interpreted by Vim as word-right and word-left. I can't set up mappings because I don't know what keystrokes are being generated.
wildwizard - thanks for the suggestion, I tried that but it didn't work.
I checked that Slackware is using the Dickey xterm, and it is. I checked the xterm.SlackBuild to see how it was compiled, and the old Sun and SCO keyboards are not omitted. I did recompile and force the addition of them using --enable-sco-fkeys and --enable-sun-fkeys when running ./configure, but it made no difference to the end result. I just wanted to reassure myself that xterm was compiled in good order, and I was very happy to find that the default xterm in Slackware 14 was exactly the way I like it.
I spent a lot of time working through termcap and terminfo, but no good result.
I got onto the solution when I started tracking down through /etc/X11/app-defaults and found the entry for Xterm. I was reading through there and looking at the entries for Function Keys and noticed the menu options. There are a number of options there that control Function Key operations - Old Function-Keys, Sun Function-Keys, HP Function-Keys, SCO Function-Keys, and Termcap Function-Keys. If you want to see these menu options, fire up an xterm, put cursor in the xterm and Ctrl-Left-Click and the menu will come up. I experimented with these function key settings, and found that the last one - Termcap Function Keys - gave me the result I needed. It let me use normal function keys on my local desktop, and it gave me access to the first four function keys when I was logged in to the Sun boxes, and best of all it didn't affect Vim operation. Excellent. I didn't want to have to set this every time I opened an xterm - I wanted the setting loaded by default, so I added this line to my .Xdefaults file:
and removed all other entries to do with function keys. So now when I start X, my .Xdefaults file is loaded automatically (xrdb -load $HOME/.Xdefaults), and it all works successfully exactly the way I need it to work.
I did some lookback into the Dickey xterm and I note that there have been many changes to the fucntion key functionality. The notes for xterm-271 on 2011/07/14, show some. http://lists.debian.org/debian-x/2011/07/msg00241.html
. I doubt if this was when things changed. I was using xterm-271 until I installed Slackware 14 and we went to xterm-287. It could have been any of the patches between 271 and 287.
While I was working through this problem, I discovered many other things. I no longer need my xorg.conf. When I removed it, I suddenly found that fonts become beautiful. I was very happy with that. I cleaned out a lot of old cruft to do with fonts, and things look nice now. I also noticed that the approved method to start fvwm2 and xfce is to start a dbus-launch and have it run fvwm2 or xfce. I tried it with and without and cannot see any benefit to it, so I didn't bother and went back to my old methods of starting them with just "fvwm2" and "startxfce4".