Please enable JavaScript to view this site.

ESL Documentation

Prototype

subroutine EcsSendKey(integer:KeyCode)

Description

Emulates pressing a specified key on a 3270/5250 terminal.

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_ERRORFREE

No errors were generated

Example

###***************************************

###  Actions to send a key to the emulator

###***************************************

action SendKey is

    if ( Other_RB is checked ) then

        extract from text of Keys_CMB

            skip by 38

            take by number Key_IV

        call EcsSendKey ( Key_IV )

        copy errorlevel to ErrorLevel_IV

        copy "EcsSendKey" to Call_SV

    else

         copy ECS_ENTER to Key_IV

        call EcsSendENTER ( Key_IV )

        copy errorlevel to ErrorLevel_IV

        copy "EcsSendKey" to Call_SV

    end if

    if ( ErrorLevel_IV = ECS_E_ERRORFREE ) then

        call EcsWatchAndWait(TimeLimt_IV, WatchCommand_SV)

        copy "Key was pressed successfully" to Message_SV

        action DisplayMessage

    else

        action DisplayError

    end if

    make PressKey_DB invisible

    make PressKey_DB temporary