Previous Topic: &FSM

Next Topic: &LOOPCTL


&INKEY

The &INKEY system variable contains a value representing the key last used to enter data.

&INKEY is a system variable that is used to determine the last method of input to a procedure from either a full-screen panel or an LU1 type device.

&INKEY is set as follows:

Program function key values (PFnn) and attention keys(PAnn) do not apply to an LU1 type terminal.

Program attention keys (PA1 to PA3) are available only to a procedure running with the &CONTROL PAKEYS option.

Typically, NCL procedures test &INKEY to determine the next action to take.

By default, certain function keys are allocated for use by the system and so are intercepted before reaching the NCL procedure. An example is F4, which is typically a return-to-menu key.

The &CONTROL PFKSTD, PFKALL, and NOPFK options allow the procedure to control the level of function key interception performed by the system. For example, &CONTROL PFKSTD indicates that function keys F3 and F4 are passed to the NCL procedure, but F2 and F9 continue to perform screen split and swap functions.

The &CONTROL PFKMAP option is used if function keys 13 through 24 are assigned the same functions as function keys 1 through 12. If this option is in effect, the NCL procedure is only required to cater for function keys 1 through 12. For instance, if a user presses the F13 key, NCL places the value PF01 in &INKEY; F15 results in PF03; and so on.

Examples: &INKEY

&IF .&INKEY EQ .  &THEN +
  &GOTO .TIMEOUT 
&IF &INKEY EQ PF01 &THEN +
  &PANEL HELP

Notes:

If the panel has been defined with the #OPT control statement specifying a time interval on the INWAIT operand, and this time period has elapsed, &INKEY is set to null. Thus, it is possible for the procedure to determine whether validation is bypassed, and so on. &INKEY is also null if the time interval in the WAIT operand of an &PROMPT statement expires. Under these circumstances, some care must be taken in subsequent &IF statements that reference &INKEY, as it can have a null value and result in a syntax error. We recommend that you balance an &IF statement by using of an additional character that avoids such syntax errors when &INKEY is null, for example:

&IF X&INKEY EQ XPF01 &THEN +
 &GOTO .HELP-DISPLAY

An alternative method of determining this is the use of &CONTROL PANELRC to supply return codes to the invoking procedure on return from an &PANEL or &PROMPT statement. In this case, a return code of 12 in &RETCODE indicates that the INWAIT or WAIT time period has expired.

For function key entry, &INKEY is always four characters. Numbers below 10 always have a leading zero, for example: PF04.

The &INKEY value remains set until the next &PANEL statement.

If the full-screen environment associated with the NCL process is terminated (for example, by issuing &PANELEND), &INKEY returns a null value.

Note: For more information, see the $EASINET NCL procedure in the distribution library and the &CONTROL statement.