Visara Master Console Center Scripting Guide User Manual
Page 138
![background image](https://www.manualsdir.com/files/808700/content/doc138.png)
Chapter 5 Script Commands
Scripting Guide
138
KEY
Syntax:
KEY( %Port, $Keys [,%Timeout]) ==> %RetCode
Description:
Enters a character string to the specified console.
Action:
Keyboard keys, represented by the characters in the Keys parameter,
are sent to the console connected to the specified port just as if they
were typed from the console keyboard. The keys are sent in exactly the
order specified, left to right, in the $Keys string. If the console is
unable to accept the keystrokes, the KEY command waits a specified
amount of time until it allows them. See Notes for additional
information.
Parameters:
%Port. Numeric expression. The assigned console port number to
which the console is connected. Refer to Overview on page 12 for more
information.
$Keys. String expression. Characters and key representations to send
as keyboard typing. Refer to the KEY Command Specifics tables
following for details.
%Timeout. Numeric expression. Optional. The number of seconds to
wait for an input inhibited condition (X clock or X SYSTEM message)
to clear on a mainframe console before returning an error code
signifying the inability to key the command. If not specified, the
default value is zero, which means the KEY command does not wait for
an input inhibited condition to clear before returning.
Returns:
Numeric Value. Refer to Table 14. KEY Command following for more
information.
Notes:
1. If a mainframe console is input-inhibited in a way that will resolve
without user input (that is, without needing to press the RESET
key), the KEY command waits the amount of time specified in the
parameter %Timeout until the console is free. If this does not occur
within the timeout period, the appropriate error code is returned.
2. If a mainframe console is input-inhibited in a way that requires the
RESET key to be pressed, the KEY command issues a RESET
before entering its string.
3. If sending a RESET key does not restore the mainframe console, an
error is returned, allowing the script to engage in appropriate error
trapping.
4. The KEY command processing checks the status line after sending
keys to the console. If the status line indicates one of the following
conditions, the appropriate status is returned to the script.
-
Last key not accepted (X ?+)
-
Bad function (X -f)
-
Too much data (X man >)
-
Numeric only (X man #),
If the status line indicates X (clock) or X SYSTEM, it is assumed
the command was submitted properly and no error is returned to
the script. This is because a KEY command might set the X (clock)
or X SYSTEM flag on the status line while the command is being
processed. Consequently, it may be difficult to distinguish between