View previous topic :: View next topic
|
Author |
Message |
Learncoholic
New User
Joined: 20 Sep 2007 Posts: 97 Location: India
|
|
|
|
Hi,
I am fairly new to REXX & have written the following program:
Code: |
ADDRESS ISPEXEC "DISPLAY PANEL(AAAAAAAA)"
ADDRESS ISPEXEC "VGET (ZPFKEY) ASIS"
SELECT
WHEN ZPFKEY = 'PF03' THEN
SAY 'F3 PRESSED'
WHEN ZPFKEY = 'PF08' THEN
SAY 'F8 PRESSED'
WHEN ZPFKEY = 'PF07' THEN
SAY 'F7 PRESSED'
OTHERWISE
EXIT
END |
On executing the above code, only PF3 is working fine but neither PF7 or PF8 is working as desired.
Kindly let me know what shall I do to make it work.
Thanks |
|
Back to top |
|
|
Ranjithkumar
New User
Joined: 10 Sep 2008 Posts: 93 Location: India
|
|
|
|
Have you set the .PFKEY control variable in your panel code? |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
ISPF knows what PFkey has been pressed, and based on what command the user has associated with each key, will issue that command.
Why do you care which key the user pressed? |
|
Back to top |
|
|
Learncoholic
New User
Joined: 20 Sep 2007 Posts: 97 Location: India
|
|
|
|
Ranjithkumar wrote"
Quote: |
Have you set the .PFKEY control variable in your panel code? |
Hi Ranjithkumar,
I have used .PFKEY in PROC section of the PANEL & still it is not working
superk wrote:
Quote: |
ISPF knows what PFkey has been pressed, and based on what command the user has associated with each key, will issue that command.
Why do you care which key the user pressed? |
Hi Superk,
My Panel AAAAAAAA actually instructs the user to press PF keys to execute various functions. Hence I want to check what PF key has the user pressed.
In the above case the code is working fine for PF3 but not for PF7 or PF8. Actually the full code is somewhat like:
Code: |
ADDRESS ISPEXEC "DISPLAY PANEL(AAAAAAAA)"
ADDRESS ISPEXEC "VGET (ZPFKEY) ASIS"
SELECT
WHEN ZPFKEY = 'PF03' THEN
ADDRESS ISPEXEC "DISPLAY PANEL(BBB)"
WHEN ZPFKEY = 'PF08' THEN
ADDRESS ISPEXEC "DISPLAY PANEL(CCC)"
WHEN ZPFKEY = 'PF07' THEN
ADDRESS ISPEXEC "DISPLAY PANEL(DDD)"
OTHERWISE
EXIT
END |
Kindly note that my ID has PF7 defined as "UP" & PF8 as "DOWN".
Thanks |
|
Back to top |
|
|
Ranjithkumar
New User
Joined: 10 Sep 2008 Posts: 93 Location: India
|
|
|
|
Learncoholic
Can you post your panel code? |
|
Back to top |
|
|
Learncoholic
New User
Joined: 20 Sep 2007 Posts: 97 Location: India
|
|
|
|
Hi Ranjithkumar,
Please find my Panel definition below:
Code: |
)ATTR
% TYPE(INPUT) INTENS(LOW) JUST(ASIS)
$ TYPE(OUTPUT) INTENS(LOW) COLOR(WHITE)
# TYPE(TEXT) INTENS(LOW) CAPS(OFF) SKIP(ON)
* TYPE(INPUT) INTENS(HIGH) JUST(LEFT) PAD('_')
)BODY EXPAND(||) /* EXPAND WINDOW TO FULL SCREEN */
$ZDATE $ZTIME#|-|- MY DATA RELATED PANEL 3 -|-|DCSRATE3
#COMMAND ===>%ZCMD #
# $DISP #
# A - PRESS PF3 TO GO TO PANEL 2
#
# B - PRESS PF7 TO GO TO PANEL 3
#
# C- PRESS PF8 TO GO TO PANEL 4
)INIT
)PROC
&KEY = .PFKEY
)END |
|
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Why are you trying to over complicate things here.
The standard practice is to type the code for the required action on the command line and press enter to continue. The background REXX (or God forbid CLIST) can then handle the situation far more easily.
Also think of the people that will have to maintain / amend this code. Kepp it simple and everyone stays happy.
Just as an aside -you say that PF3 works. Are you certain that it works or is the panel being closed as expected and the underlying code just happens to display the panel related to PF3 as a matter of course. |
|
Back to top |
|
|
Ranjithkumar
New User
Joined: 10 Sep 2008 Posts: 93 Location: India
|
|
|
|
Hi
Remove the following line from your Rexx.
Code: |
ADDRESS ISPEXEC "VGET (ZPFKEY) ASIS"
|
And change all ZPFKEY to KEY as below.
Code: |
SELECT
WHEN KEY = 'PF03' THEN
ADDRESS ISPEXEC "DISPLAY PANEL(BBB)"
WHEN KEY = 'PF08' THEN
ADDRESS ISPEXEC "DISPLAY PANEL(CCC)"
WHEN KEY = 'PF07' THEN
ADDRESS ISPEXEC "DISPLAY PANEL(DDD)"
OTHERWISE
EXIT
END
|
Try this and let us know if its working. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
The other thing is, ISPF needs to know how to handle the commands associated with those keys. In your case, I'd suggest that you (using the KEYS command) associate END to PF03, PF07, and PF08. Now, as you know, END will end the DISPLAY service. Then, you could, upon exiting the panel, check for the value of the key pressed and take that course of action, else honor the user entering the END command and exit the app. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
This is the bit that bugs me. Why bother to change the PFkey settings when the good old tried and trusted method of ZCMD works, and works extremely well.
I think this is just a case of trying to be smart for the sake of trying to be smart.
I have not assigned different values to PFkeys for donkeys years now, and if I recall, unless you do it carfully it could globally change the key values causing all sorts of little hiccups in later times.
Embrace the KISS method, where KISS = KEEP IT SIMPLE STUPID |
|
Back to top |
|
|
Learncoholic
New User
Joined: 20 Sep 2007 Posts: 97 Location: India
|
|
|
|
Ranjithkumar wrote:
Quote: |
Try this and let us know if its working. |
Hi Ranjithkumar,
I tried as you suggested & this is not working out.
expat wrote:
Quote: |
Just as an aside -you say that PF3 works. Are you certain that it works or is the panel being closed as expected and the underlying code just happens to display the panel related to PF3 as a matter of course. |
Hi expat,
I believe that PF3 works as there is no underline code to display related panel. Also a display confirms when a PF4 is pressed.
superk wrote:
Quote: |
The other thing is, ISPF needs to know how to handle the commands associated with those keys. In your case, I'd suggest that you (using the KEYS command) associate END to PF03, PF07, and PF08. Now, as you know, END will end the DISPLAY service. Then, you could, upon exiting the panel, check for the value of the key pressed and take that course of action, else honor the user entering the END command and exit the app. |
Hi superk,
I did as you suggested & this is working out fine. Thank you so much for your help.
Thanks |
|
Back to top |
|
|
MBabu
Active User
Joined: 03 Aug 2008 Posts: 400 Location: Mumbai
|
|
|
|
One final (?) note.. Sorry for the tone, but I'd like it to be strongly emphasized:
ISPF developers should never, ever check for specific PF keys. ISPF is command driven. Period. Forget that things like .PFKEY, ZPFxx, etc exist. Don't use them. Just don't.
Never. No exceptions. ISPF is not CICS. Don't do it. Don't. (hope that was clear )
The reasons are many, but basically- Users can change PF keys.
- Setting keys in the profile breaks other applications
- If your program abends or does not clean up, other apps will break and you won't have a clue why.
- Commands from the command table are processed before you see these variables. you may never see them at all.
- KEYLISTs (sorry - I normally don't say dirty words in public).
- You will end up changing to command driven eventually, so save yourself the trouble and just start that way.
|
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
Quote: |
KEYLISTs (sorry - I normally don't say dirty words in public). |
I like keylists. You can define special purpose keys that are unique to your application. It does not show keys that will not work in your application (ie. 'CHANGE') |
|
Back to top |
|
|
MBabu
Active User
Joined: 03 Aug 2008 Posts: 400 Location: Mumbai
|
|
|
|
Yeah, but keylists make it difficult to define global keys. I always run with KEYLIST OFF so my keys are consistent and PFSHOW OFF since I then know what the keys are and I get 2-4 more lines of usable area. I realize that many people either don't change PF keys or don't care about having specific keys everywhere, and some even keep PFSHOW ON, but since one of the 1st things I do when I set up an ISPF session is set keys to NRETRIEV, AUTOTYPE, RESIZE and TSO (or actually one of those execs that captures TSO output in browse), I don't want to have to worry about when my keys are available and when they are not. Still, to the original point, keylist users can also be harmed, confused or misled by checking for specific keys. |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
Changing PF keys is a very bad idea, specially if your user auto-logoff after being inactive some time.
When this happens, the modified keys become the new default.
If the users loose the use of their PF7/PF8 keys under ISPF, it's not gonna look good.
Using KEYLIST is better because the keys are linked to the panel. When the panel is gone, so are the changes.
Learn by:
- adding SAY of the PF key before the select. You will see that it does not show when you hit PF7 or PF8.
This is because the keys are processed by ISPF in the panel before they reach the program.
- using standard conventions, as expat already wrote (twice).
- reading some ISPF Hints and Tips
Never ever modify PF1 to PF4 and PF7 to PF12, or PF5 and PF6,
and be careful with the rest (PF13 to PF24). |
|
Back to top |
|
|
Learncoholic
New User
Joined: 20 Sep 2007 Posts: 97 Location: India
|
|
|
|
Hi All,
I tried to use two static panels to display the required information. I thought that whevever the user pressed F8, I would trap it, then display the next panel. If the user pressed F7, I would again trap it & display the first panel. So will be the processing till the user pressed F3.
As of now I have changed the panel to a scrollable panel & have had a successful run.
Hi MBabu,
Thanks for explaining in detail the cons of using .PFKEY & ZPFxx. In future I will avoid using them.
Hi Marso,
Thanks for sharing the ISPF Hints & Tips.
Hi expat,
I apologize for replying late. Thanks for sharing the info about ZCMD. I went with PFKEYS because I am new to REXX & had searched & found the usage of PFKEYS quicker.
Marso wrote:
Quote: |
adding SAY of the PF key before the select. You will see that it does not show when you hit PF7 or PF8.
This is because the keys are processed by ISPF in the panel before they reach the program. |
Hi Marso,
Like you said that PF7 & PF8 is processed by ISPF in the panel before they reach the program. So does UP/DOWN command. Is there a way of trapping those commands in REXX module.
Thanks |
|
Back to top |
|
|
|