The previous example will not work unless the device is set to APPLICATION. DEC DATATRIEVE ignores the the terminal characteristics of your device, for this reason you must execute the FN$KEYPAD_MODE function before executing the FN$DEFINE_KEY function.