The &INKEY system variable returned to the NCL procedure following a synchronous &PANEL statement, is set to indicate how input was made (for example, by using the Enter key).
After displaying a panel, Panel Services waits either for you to complete input (signaled by pressing the Enter key or some other function key), or for a time-out interval to expire (where an INWAIT period has been specified on the #OPT control statement).
The &INKEY system variable can be tested to find out whether operator input has occurred, and to provide support for Function keys.
If the INWAIT time period elapses, &INKEY is set to a null value. If INWAIT did not expire, &INKEY is set to one of the following strings:
|
Entry type |
&INKEY value |
|
Enter key |
ENTER |
|
Function key |
F01 to F24 (always 4 characters) |
|
PA key |
PA1 to PA3 |
|
LIGHT PEN |
ENTER |
Note: If &CONTROL PFKMAP is in effect, F13 to F24 are presented as F01 to F12.
&INKEY can be tested like any other system variable, for example:
&IF &INKEY EQ PF01 &THEN &PANEL HELP
Remember that where INWAIT is used a null value can be set for &INKEY. Therefore, &IF statements using &INKEY must allow for a possible null value syntax error if &INKEY is eliminated from the statement by variable substitution. This can be achieved as follows:
&IF .&INKEY EQ . &THEN &GOTO .NOINPUT
Alternatively, to determine if the INWAIT timer has expired, use return codes from Panel Services as requested by &CONTROL PANELRC. In this case, a return code of 12 is set in the &RETCODE system variable to indicate the INWAIT time interval has expired.
For more information about how you can greatly simplify testing individual function key values by using direct branching techniques, see the &GOTO verb in the Network Control Language Reference Guide.
Example: Panel Input
&CONTROL NOLABEL
.DISPLAY
&PANEL MYMENU
&GOTO .MENU&INKEY
.
.
drops through if key not supported.
.
.
&SYSMSG = &STR INVALID SELECTION
&GOTO .DISPLAY
.MENUENTER-* comes here if ENTER key pressed
.
.
.MENUPF01-* comes here if F1 pressed
.
.
.MENUPF02-* comes here if F2 pressed
.
.
....
The &GOTO .MENU&INKEY statement is resolved as an &GOTO to label constructed by the current value of &INKEY suffixed to .MENU. If the label is not found, the &GOTO acts as a null statement. Control passes to the next statement because the &CONTROL NOLABEL operand was used.
Note: &INKEY is a system variable, so any attempt to assign a value into &INKEY results in an error.