ON( ) Function

Example   See Also

Returns the command assigned to each of these event-handling commands: ON ERROR, ON ESCAPE, ON KEY LABEL, or ON PAGE.

Syntax

ON(cONCommand [, KeyLabelName])

Returns

Character

Arguments

cONCommand

Specifies one of the event-handling commands. Here are the commands and corresponding character expressions to use with ON( ):

Command cONCommand
ON ERROR ERROR
ON ESCAPE ESCAPE
ON KEY LABEL KEY
ON PAGE PAGE

For example, to return the command currently assigned to ON ERROR, use the following:

? ON('ERROR')

KeyLabelName

Used in ON KEY LABEL to specify a key or key combination to which the command is assigned. Specify KEY in cONCommand and the key label name of the key or key combination in KeyLabelName. For a complete list of key label names, see ON KEY LABEL.

For example, to return the command currently assigned to the F7 function key with ON KEY LABEL, use the following:

? ON('KEY', 'F7')

Remarks

When an event occurs that is trapped by one of the event-handling commands, the command assigned by the event-handling command executes. ON( ) returns the command you assigned to an event-handling command. ON( ) returns an empty string if a command isn't currently assigned to the event-handling command you specify.