Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1083153
  • 博文数量: 106
  • 博客积分: 9093
  • 博客等级: 中将
  • 技术积分: 2770
  • 用 户 组: 普通用户
  • 注册时间: 2006-06-01 17:22
文章分类

全部博文(106)

文章存档

2014年(1)

2012年(29)

2011年(32)

2010年(20)

2008年(24)

分类:

2011-06-28 16:24:37

Many versions and years ago something called KEYLISTS was introduced in ISPF. Most of us has ever since felt that KEYLISTS were implemented to make our ISPF life even more complicated. About four years ago I did not know anything about KEYLISTS except the command KEYLIST OFF. This command effectively disables KEYLIST functionality in ISPF. For more than four years ago I felt that some day I would find some kind of reasonable use for KEYLISTS.

Often I need to assign special values to F-keys on my ISPF panels. Traditionally I save the current value of a function key, assign it a new value and at the end of the application I reinstate the saved value. This approach has a drawback; if users activate other ISPF functions from my panel, the new F-key value is inherited by the activated functions. In other cases an ISPF abend occurs in my application and the new F-key value survives the crash instead of the original one. This is very annoying for the users.

The ideal situation is of course to have function key values that are related to the ISPF panel and nothing else. This is exactly what you can do with KEYLISTS. You can also do a lot of other stuff with KEYLISTS which will turn your ISPF life into hell. This tip is only dealing with a method that may be used to assign specific function key values to specific function keys on a specific panel using KEYLISTS.

A KEYLIST that users have in common is called a SHARED KEYLIST. Such a KEYLIST must be stored in the ISPTLIB concatenation. The following REXX creates an ISPF table containing a KEYLIST called MYKEYS. An ISPF table must have a name ending with KEYS to be considered a KEYLIST:

/* REXX */
ADDRESS ISPEXEC
"CONTROL ERRORS RETURN"

/* FETCH THE LAYOUT OF A KEYLIST ISPF TABLE */
"TBOPEN ISPKEYS NOWRITE"
"TBQUERY ISPKEYS KEYS(KEYSLIST) NAMES(NAMELIST)"
"TBEND ISPKEYS"

/* CREATE THE KEYLIST IN ISPF TABLE MYKEYS */
"TBCREATE MYKEYS KEYS"KEYSLIST" NAMES"NAMELIST" WRITE REPLACE"
KEYLISTN = 'MYKEYS'
KEY1DEF = 'HELP'; KEY1LAB = 'Help'; KEY1ATR = ''
KEY2DEF = 'SPLIT'; KEY2LAB = 'Split'; KEY2ATR = ''
KEY3DEF = 'END'; KEY3LAB = 'End'; KEY3ATR = 'SHORT'
KEY4DEF = 'RETURN'; KEY4LAB = 'Return'; KEY4ATR = ''
KEY5DEF = 'RFIND'; KEY5LAB = 'Rfind'; KEY5ATR = ''
KEY6DEF = 'MYCMD'; KEY6LAB = 'MyCmd'; KEY6ATR = 'LONG'
KEY7DEF = 'UP'; KEY7LAB = 'Up'; KEY7ATR = ''
KEY8DEF = 'DOWN'; KEY8LAB = 'Down'; KEY8ATR = ''
KEY9DEF = 'SWAP'; KEY9LAB = 'Swap'; KEY9ATR = ''
KEY10DEF = 'LEFT'; KEY10LAB = 'Left'; KEY10ATR = ''
KEY11DEF = 'RIGHT'; KEY11LAB = 'Right'; KEY11ATR = ''
KEY12DEF = 'RETRIEVE'; KEY12LAB = 'Retrieve'; KEY12ATR = ''
"TBADD MYKEYS"
"TBCLOSE MYKEYS"
EXIT

For each function key the column KEYxDEF is assigned the value of the function key, KEYxLAB is assigned the text that is displayed when PFSHOW is ON and KEYxATR is assigned a value telling ISPF how to display the KEY when PFSHOW is ON. Only function keys where KEYxATR is assigned the value LONG or SHORT is displayed. I have left out the assignment of keys 13 to 24. It is your job to add them. If you do not assign any values to these keys they cannot be used at all. Every time you run this REXX you will replace the existing ISPF table MYKEYS in the dataset allocated to DD name ISPTABL. It is possible to have more than one KEYLIST in the same ISPF table but I have chosen only to have one called MYKEYS just like the name of the ISPF table. It is column KEYLIST that contains the name of the KEYLIST.

To make a KEYLIST available for other users you must copy it to one of the datasets on the ISPTLIB concatenation that the other users also has allocated to their ISPTLIB concatenation. Now all you need to use your KEYLIST is to add the following line on top of your ISPF panel:

)PANEL KEYLIST(MYKEYS,MY,SHARED)

The ISPF panels where you add the above line will use the function key values that you gave them in your REXX. The parameter MYKEYS is the name of the KEYLIST that must be used on the panel. MY is the name of the ISPF table where the KEYLIST must be located. MY is concatenated with KEYS giving MYKEYS as the ISPF table name. Parameter SHARED indicates that it is not possible to edit the function key values using KEYS. SHARED also disables the possibility of using socalled PRIVATE KEYLISTS. With SHARED you effectively prevent any kind of changes to the values of the function keys on a specific ISPF panel while other ISPF panels and function key values remains unaffected. This was just what I wanted to acheive. Now I have put an end to the old behaviour of saving and restoring function key values.

阅读(1306) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~