The PFK built-in function provides function key assignment information by command or key number.
>>-variable--=--PFK--(value)-----------------------------------><
&X = PFK (HELP)
&Y = PFK (2)
In the first example, the first function key that is assigned to the HELP command is returned in variable X as a character string PFnn, where nn is the function key number. If CUA mode is set, or the panel has an active keylist, the character string is Fnn, where nn is the function key number. If the HELP command is not assigned to a function key, a blank value is returned.
In scanning the current function key definitions, the primary keys are scanned first, then the secondary keys. If KEYLIST OFF has been issued, ISPF searches the ZPF variables. On a 24-key terminal, for example, if both function keys 13 and 1 are assigned to HELP, the function returns F13.
In the second example, the command assigned to F2 is returned in variable Y. If no command is assigned to the key requested, a blank value is returned.