The DEFINE command (abbreviated DEF) defines either editing keys for keypad mode or macros for line mode.
1 – KEY
The DEFINE KEY (abbreviated DEF K) command creates definitions for editing keys for use in keypad mode. You can redefine keypad keys, control key sequences and GOLD control key sequences. You can also define function keys, for terminals that have them. Format: DEFINE KEY key-name AS 'string'
1.1 – KEY-NAME
Format: DEFINE KEY key-name AS 'string' Key-name is one of the following: [GOLD] [FUNCTION] number [GOLD] CONTROL character [GOLD] CONTROL "character" [GOLD] CONTROL 'character' [GOLD] DELETE GOLD character GOLD "character" GOLD 'character' Number refers to keypad and function keys. CONTROL character names specific control keys (upper- and lowercase letters are considered equivalent). A character following CONTROL is limited to @, A to Z, [, \, ], ^ and _. DELETE refers to the delete key, which is not a control character. Character not following CONTROL can be any keyboard key except 0-9, though - is not useful. Characters !, %, ', and " must be enclosed in quotation marks; other characters can be.
1.2 – STRING
Format: DEFINE KEY key-name AS 'string' The string is a string of nokeypad mode commands that define the function of the key. If you want the command to be executed when the key is struck, the definition must end with a period. Otherwise, EDT will accumulate definitions until the user types a key whose definition ends with a period, and then execute them all together.
1.2.1 – ?
You can use a question mark (?) or question mark and asterisk (?*), in key definitions to prompt the user for input. The ? is replaced by the characters read from the terminal before the command is executed. A prompt string enclosed in single quotation marks may follow the ?. A response to an input request generated by a ? must be terminated by pressing a keypad or function key, whereas a response to a ?* can be terminated by pressing a keypad key, a function key or the return key.
1.2.2 – RESET
If you define a key as 'RESET' (must be exactly five characters) the key will perform the RESET keypad function. RESET is not a nokeypad command. Do not put a period at the end of the definition.
1.2.3 – GOLD
If you define a key as 'GOLD' the key will perform the GOLD keypad function. GOLD is not a nokeypad command. Do not put a period at the end of the definition.
1.3 – EXAMPLES
To define the key CTRL/A to move 3 lines, use the following command: DEFINE KEY CONTROL A AS '3L.' To define the GOLDed function of the up-arrow key to mean "go to top of buffer," use the following command: DEFINE KEY GOLD 12 AS 'BR.' To define the key CTRL/D to write your COBOL identification division header for you, use the following command: DEFINE KEY CONTROL D AS 'iIDENTIFICATION DIVISION.^Z^MiPROGRAM-ID. ?^Z.' (After pressing the key, type the program name.) To define the CTRL/R key to prompt for the name of a BLISS routine, which it will then find, use the following commmand: DEFINE KEY CONTROL R AS "BR ADV 'ROUTINE ?'Routine name: ''."
1.4 – VT52
+-------+-------+-------+-------+ This diagram shows | | | | | the numbers of the | 20 | 10 | 11 | 12 | keypad keys on VT52 | | | | | terminals for use in +-------+-------+-------+-------+ the DEFINE KEY | | | | | command. | 7 | 8 | 9 | 13 | | | | | | +-------+-------+-------+-------+ | | | | | | 4 | 5 | 6 | 14 | | | | | | +-------+-------+-------+-------+ | | | | | | 1 | 2 | 3 | 15 | | | | | | +-------+-------+-------+-------+ | | | | | 0 | 16 | 21 | | | | | +---------------+-------+-------+
1.5 – VT100
+-------+-------+-------+-------+ +-------+-------+-------+-------+ | | | | | | | | | | | 12 | 13 | 15 | 14 | | 20 | 10 | 11 | 17 | | | | | | | | | | | +-------+-------+-------+-------+ +-------+-------+-------+-------+ | | | | | The diagram to the right shows the | 7 | 8 | 9 | 18 | numbers of the keypad keys on VT100 | | | | | terminals for use in the DEFINE KEY +-------+-------+-------+-------+ command. Above are the numbers for | | | | | the arrow keys, for terminals that | 4 | 5 | 6 | 19 | do not have function keys. | | | | | +-------+-------+-------+-------+ | | | | | | 1 | 2 | 3 | | | | | | | +-------+-------+-------+ 21 | | | | | | 0 | 16 | | | | | | +---------------+-------+-------+
1.6 – FUNCTION-KEYS
+--+--+--+--+--+--+--+--+--+--+--+--+-----+--+--+--+--+--+ |17|18|19|20|21| |23|24|25|26| |28| 29 | |31|32|33|34| +--+--+--+--+--+--+--+--+--+--+--+--+-----+--+--+--+--+--+ The diagram above and right shows the numbers +--+--+--+ of the function keys. When used with the | 1| 2| 3| DEFINE KEY command these numbers must be +--+--+--+ preceeded by the word FUNCTION. | 4| 5| 6| +--+--+--+ The diagram to the right shows how the arrow +--+ keys are numbered on terminals which have |12| function keys. These keys do not use the word +--+--+--+ FUNCTION when defined using the DEFINE KEY |15|13|14| command. +--+--+--+
2 – MACRO
The DEFINE MACRO (abbreviated DEF M) command defines a line mode macro command. Format: DEFINE MACRO name The name is the name of the text buffer in which the macro is stored. The macro itself is a series of EDT line mode commands. You invoke the macro by giving its name in response to the line mode prompt.