KEY

 

  ON              

 
    OFF            
KEY

PAn

 

ON

 
  PFn = OFF ...
  CLR   command  

This command is used to assign functions to keys on the keyboard of video terminals. Moreover, you can change, activate and deactivate the assigned functions.

This is possible for the following keys:

  • PA1 to PA3,

  • PF1 to PF24

  • CLEAR

To each of these keys, you can assign one of the following functions:

  • a Natural system command,

  • a Natural terminal command,

  • a user-defined command.

Natural will execute the assigned command whenever you press the corresponding key in command mode (NEXT prompt).

Notes:

  1. Assignments made with the system command KEY are totally independent of assignments made with a SET KEY statement in a program.
  2. Function-key assignments can also be made by the Natural administrator via the profile parameter KEY.
  3. This command is not executable in batch mode.

This document covers the following topics:


Assigning Commands

If you enter only the command KEY (without parameters), the Function-Key Assignments screen will be displayed. On this screen, you can assign commands to the individual keys by entering the command names in the input fields.

To assign a different command to a key, you overwrite the existing entry in the input field.

To delete a command assignment, you delete the entry in the input field or overwrite it with blanks.

You can also assign commands to individual keys by specifying them directly with the KEY command. For example:

KEY PF1=CLEAR

If the assigned command contains blanks, it has to be enclosed in apostrophes. For example:

PF13='UPDATE OFF'

Activating/Deactivating All Keys - KEY ON/OFF

With the command KEY OFF/ON, you deactivate/re-activate all function-key assignments:

KEY OFF If you the press a function key, Natural will return an appropriate message indicating that the key is not active.
KEY ON Re-activates all function-key assignments that have previously been deactivated with KEY OFF.

You can also activate/deactivate the keys by overwriting the entry ON/OFF in the field Activate Keys at the top right-hand corner of the Function-Key Assignments screen.

Note:
The CLEAR key cannot be activated/deactivated. Unless another function is assigned to it, it has the same function as the terminal command %%. The command KEY ON/OFF and the Activate Keys field have no effect on the CLEAR key.

Activating/Deactivating Individual Keys - KEY key=ON/OFF

With the command KEY key=OFF/ON, you deactivate/re-activate the command assigned to a specific key.

KEY key=OFF Deactivates the command assigned to a specific key. For example:
KEY PF24=OFF
KEY key=ON

Re-activates a previously deactivated command assignment. For example:

KEY PF24=ON

Note:
The commands KEY CLR=ON and KEY CLR=OFF are not possible (see also note above).