Prototype
subroutine EcsPressKey(integer:KeyCode)
Description
Emulates pressing a specified key on a 3270/5250 terminal. If the AutoWait feature is enabled, then the predefined watch command(s) within the global variables EcsWatchCommandString and EcsTimeLimit are used to attempt a screen synchronisation.
Parameters
| KeyCode | Input | An integer set to one the constants defined in the ESLCMSRV include file, for example, ECS_ATTN. | 
Return Value
| ECS_E_NOTINIT | Not initialized - command was ignored | 
| ECS_E_NOTCONN | Not connected to an active session | 
| ECS_E_SENDKEY | Failed to send keystroke | 
| ECS_E_INUSE | Session is already in use | 
| ECS_E_BADKEYCODE | Key code is unrecognized | 
| ECS_E_WATCH | Empty or invalid EcsWatchCommandString | 
| ECS_E_MULTWATCH | Multiple watches are not currently supported | 
| ECS_E_BADTIME | Illegal time limit specified (0 < time limit < 1 hour) in EcsTimeLimit | 
| ECS_E_ERRORFREE | No errors were generated | 
Example
###***************************************
### Actions to send a key to the emulator
###***************************************
action PressKey is
if ( Other_RB is checked ) then
extract from text of Keys_CMB
skip by 38
take by number Key_IV
call EcsPressKey ( Key_IV )
copy errorlevel to ErrorLevel_IV
copy "EcsPressKey" to Call_SV
else
call EcsPressENTER ( )
copy errorlevel to ErrorLevel_IV
copy "EcsPressEnter" to Call_SV
end if
if ( ErrorLevel_IV = ECS_E_ERRORFREE ) then
copy "Key was pressed successfully" to Message_SV
action DisplayMessage
else
action DisplayError
end if
make PressKey_DB invisible
make PressKey_DB temporary