View previous topic :: View next topic |
Author |
Message |
Phantom Data Mgmt Moderator

Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Wed Apr 02, 2003 10:56 pm Post subject: Function Keys |
|
|
Can we alter the command associated with a PF key using a REXX Utility.
Whenever a swap command is issued thro' a Function key, I want to do some operations before the swap command takes effect. But, since system commands take priority over the user commands, I am unable to work on this.
So, first I want to know what function key is associated to the swap command thro; rexx and change the swap command to my rexx utility, which performs the pre-processing operations and then issues the SWAP command.
Please guide me. |
|
Back to top |
|
 |
Mike Beginner

Joined: 03 Dec 2002 Posts: 114 Topics: 0 Location: Sydney, Australia
|
Posted: Thu Apr 03, 2003 6:35 pm Post subject: |
|
|
This shouldn't be a problem as you can interrogate and set the ISPF variables associated with the PF keys, these bieng ZPFnn. Here's some untested code that should assist you, assuming that the command is called PRESWAP and that ; is the command delimiter (you'd might want to save the original settings and then restore them):-
Code: |
ADDRESS ISPEXEC
"VGET (ZPF01 ZPF02 ZPF03 .....) PROFILE"
Select
If ZPF01 = "SWAP" Then Do
ZPF01 = "PRESWAP;SWAP"
"VPUT (ZPF01) PROFILE"
End
If ZPF02 = "SWAP" Then Do
ZPF02 = "PRESWAP;SWAP"
"VPUT (ZPF02) PROFILE"
End
Otherwise NOP
End
|
_________________ Regards,
Mike. |
|
Back to top |
|
 |
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Thu Apr 03, 2003 8:13 pm Post subject: |
|
|
you're app will never see the swap command or any other that is defined in the command table. You'll need your own command table or to modify the current one.
Changing PF keys this way should be strongly discouraged. First, it affects all programs within the applid. 2nd, if the program abends, you can't clean up, 3rd it often assumes that users haven't redefined their keys. This type of situation is what command files and/or keylists (yuk!) are for.
Last edited by semigeezer on Thu Apr 03, 2003 10:23 pm; edited 2 times in total |
|
Back to top |
|
 |
DaveyC Moderator

Joined: 02 Dec 2002 Posts: 151 Topics: 3 Location: Perth, Western Australia
|
Posted: Thu Apr 03, 2003 9:02 pm Post subject: |
|
|
Mike,
Of course, you meant
Code: |
When ZPF01 = "SWAP" Then Do...
|
No worries,
DC _________________ Dave Crayford |
|
Back to top |
|
 |
CaptBill Beginner
Joined: 02 Dec 2002 Posts: 100 Topics: 2 Location: Pasadena, California, USA
|
Posted: Fri Apr 04, 2003 11:59 am Post subject: |
|
|
While I generally agree with semigeezer that this sort of thing is to be discouraged, there are times when I do it myself. It really depends on who will use the process. If its just for me, then I do what I want and worry about the cleanup myself. If it is for someone else, then I make sure I clean up after myself. Here is an example of some code I use to see if the user has PFSHOW ON set.
Code: |
ADDRESS ISPEXEC "VGET (ZPFSHOW)"
IF ZPFSHOW = 'ON' THEN DO
PFSHOWWASON = "YES"
ADDRESS ISPEXEC "SELECT PGM(ISPOPF) PARM(OFF) NOFUNC"
END
ELSE DO
PFSHOWWASON = "NO "
END
|
Then at the end of my process I do this:
Code: |
IF PFSHOWWASON = "YES" THEN
ADDRESS ISPEXEC "SELECT PGM(ISPOPF) PARM(ON) NOFUNC"
EXIT
|
which restores the value of PFSHOW to what it was when my process started. The same can be done for PFKEYs.
Semigeezer said if your process abends, that would not clean up things properly, and he he correct. I suppose you could solve this by comparing the values saved in the profile to ones corrently saved and changing them but that involves more work, and I elected not to do it. |
|
Back to top |
|
 |
|
|