Previous Topic: $INTERNALDATE FunctionNext Topic: $LENGTH Function


$KEY Function

An alphanumeric function that returns an indicator of the last key pressed for the last panel transmitted or the specified panel.

This function has the following format:

$KEY [(panel‑name)]
$KEY

Returns the name of the last key pressed for the specified panel. If no panel‑name is specified, $KEY returns the name of the last key pressed for the last panel transmitted.

panel‑name

The name of the panel tested.

This function returns a variable‑length indicator. The values returned are:

ENTER

N/A (panel not transmitted)

PF01

PF02

.

.

.

PFnn

Example

The NOTIFY statement displays a message on the panel message line. The following statement checks that the last key pressed was PF1‑9 (for example, was not Enter, and that N/A was not returned). If not, it displays a message specifying the invalid key typed by the user:

IF $KEY(PANEL‑A) GE 'PF01' AND $KEY(PANEL‑A) LE 'PF09'
  DO PROCESS‑PANEL
ELSE
  NOTIFY $KEY ' IS NOT VALID FOR THIS TRANSACTION.
'ENDIF