SEND_KEY

Use the SEND_KEY statement to simulate keyboard input to the current 3270 screen at the current cursor position. This statement can be used to send anything that can be typed on a 3270 terminal, including keyboard keys, strings, numbers, or variable names. Special keywords are provided for keyboard keys, such as ENTER, PA1, PF1, PF2, and so on. For a list of the keywords, select Keys in the Send Key Definition window. See Table 1 and Table 1 for lists of 3270 and AS/400 key equivalents.

When multiple parameters are specified, they are sent to the 3270 screen in sequence. However, it is recommended that you use a separate SEND_KEY statement to send the characters for each field. Do not try to send enough characters to fill in two or three fields with one SEND_KEY statement.

If the 3270 terminal emulation session is in keyboard lock condition (indicating that the host system is busy), when the SEND_KEY statement is executed, the EX_KEYB_LOCK exception definition script is invoked. By default, the script is abnormally terminated. To handle a failed SEND_KEY statement in a different way, you need to write an exception handler for this condition, as described in EXCEPTION.

Syntax


This picture shows the syntax of the SEND_KEY statement.

Example

SEND_KEY ( ENTER, TAB, "Jason" );

Procedure

To use the 3270 Script window’s Statements menu to define a SEND_KEY statement, follow this procedure:

  1. From the Welcome window, click on Applications —> 3270 Servers
  2. Selecting the SEND_KEY statement : Click Statements —> Screen —> Send Key.

    The system displays the Send Key Definition window.

  3. Selecting the parameter : Click a Term Type to send a variable, string, number, or key to a 3270 screen.

    If you select multiple values then wish to start over, click Clear to clear the selection list.

  4. Adding the statement to the script : Click OK.

    The SEND_KEY statement is added to the script.