Can anyone tell me how to use PF keys in a panel definition and in REXX program.
For example, if I have coded PF1 - Help PF3 - Exit PF10 - Process in the panel definition, what are all the things I need to do in REXX program to capture the Key pressed.
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
How are the PF keys defined to the application?
If I were to run your application on my system, I use the following definitions for my PF keys:
PF1 = HELP
PF2 = SPLIT
PF3 = END
PF4 = EXIT
PF5 = FIND
PF6 = RFIND
PF7 = UP
PF8 = DOWN
PF9 = SWAP
PF10 = LEFT
PF11 = RIGHT
PF12 = RETRIEVE
Normally, if I code a panel, I think that there are two options - either go back to a previous panel or process, or go forward to the next panel or process. A standard ISPF service call to DISPLAY will generate a return-code of zero for a key-press of the ENTER key (i.e. go forward), or a return-code of 8 for either the END or EXIT commands (PF3 or PF4 in my case), i.e. go backward. If I were to enter LEFT or press PF10, I'd get an error because left-right scrolling is not allowed in panels.
I don't know if it's possible to assign ENTER to a PF key. I also don't know why you'd want to make it harder for a normal ISPF user to do their work when they're already used to using their own PF key defintions for their designated functions.
Thanks for your reply. I am taking about the user defined panels. One can define his own ISPF panel.
The context is, I have enter some values in my panel that I designed and for processing it will use a REXX program at the backend. I want only if the user press PF10 it should process the inputs entered and if the user press PF1, it should throw the help.
My question is how to capture the keys that user pressed in the program so that I can call some subroutines for processing.
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
I don't know how to do what you're asking. I'm going to end my involvement with this quote from an ISPF expert:
Quote:
PF keys are nothing more than a means of typing a command on the command line and pressing enter. That means that resolution of the command is the same as if you typed it on the command line and pressed enter.
Commands are resolved by first looking at the command table for the the current application id, followed by the ISPCMDS command table with user command tables thrown into the mix if they are configured.
When a command other than ALIAS is processed from the command table, it is handled by ISPF and with few exceptions, your application never even sees it. For example SWAP, PRINT, LIST, RETRIEVE, etc are ISPF commands found in the command table that your program never sees. Others, such as the scrolling commands, END, and some others can sometimes be seen by the application in one way or another but not directly.
The way PF keys should work is that you define what commands in your application do, understanding that ISPF built in commands (actually anything in the command tables other than maybe scrolling and CANCEL) will not be handled by your code. Your application should respond to commands, never to specific PF keys. If you need to define your own set of default keys, create your own application id and start your application with the NEWAPPL keyword. Another option is KEYLISTs, though I personally hate keylists because they tend to make applications inconsistent even within the same application.
Why all this fuss? Because users should be able to, can and do redefine their keys, and because having the system handle the tasks that are not specific to any one application provides for a consistent user experience.
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
Code for using PF keys in REXX.
ADDRESS "ISPEXEC"
"ISPEXEC VGET (ZPFKEY) ASIS"
IF ZPFKEY = 'PF03' THEN
DO
SAY 'exiting from the tool......'
EXIT(0)
END
ADDRESS "ISPEXEC"
"ISPEXEC VGET (ZPFKEY) ASIS"
IF ZPFKEY = 'PF04' THEN
DO
statements