KEY

#### Search Results

Search

# KEY

|  |  | `ON` |  |  |  |  |  |  |  |  |
|  | `OFF` |  |  |  |  |  |
`KEY` |  |  | `PA` n |  |  |  | `ON` |  |  |
| `PF` n | `=` | `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 (Direct Command window).

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

- Activating/Deactivating All Keys - KEY ON/OFF

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

## 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.

## 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
When you deactivated an individual key (for example, `PF24=OFF`), then deactived all keys (`KEY=OFF`) and, after that, activate all keys again (`KEY=ON`), the individually deactivated key is activated, too.

### On this page

- Assigning Commands
- Activating/Deactivating All Keys - KEY ON/OFF
- Activating/Deactivating Individual Keys - KEY key=ON/OFF