Way back in week 49/2006 I wrote a tip about how to redefine all function keys on your own ISPF panel. Normally you only need to redefine one or two function keys. For these sitiations there is a much more straightforward and simple solution than the one described in my old tip.
In the following example I will redefine F6 to contain the value MYCMD on the ISPF panel where the code slices are added. When a user displays the panel and activates the KEYS command the value of PF06 will be MYCMD. On all other panels PF06 will have its normal value whatever that is.
In the INIT section you must add:
If you want to redefine more function keys you repeat the first two lines after )INIT for each function key and extents the VPUT parenthesis to contain the names of the extra function keys. If your panel contains a REINIT section you must add the same lines to this section as you have added in the INIT section. If you do not have a REINIT section I will recommend you to add one and make it contain the same lines you have added to the INIT section. If you do not update or add the REINIT section you are in great risk of losing your new function key value.
At the end of the PROC section you must add:
You should of course remember to restore all the function keys you have redefined in INIT and REINIT. Please be aware of IF indentations in ISPF panels as they control the execution flow. You must ensure that redefined function keys always are restored, otherwise you will mess up your (and especially your users) function key settings.