W$KEYBUF
The W$KEYBUF library routine allows you to send keycodes to the runtime, simulating the user input as well as recording the user input to a file for playback.
Note - calling WKBUF-ADD-TO-END or WKBUF-ADD-TO-BEGINNING within control’s Before Procedures is not supported.
Syntax:
 CALL "W$KEYBUF" USING opCode 
                       parameters
                GIVING returnCode
Parameters:
opCode
Function to be executed. Valid values, defined in iscobol.def.
 
Add keystrokes to the end of the keyboard buffer
Add keystrokes to the beginning of the keyboard buffer
Clear the keyboard buffer
Start recording keystrokes from the user input
Stop recording keystrokes from the user input
Checks whether or not the recording mechanism is on
Start recording keystrokes from the user input into a new file
Start recording keystrokes from the user input into an existing file
Read keystrokes from a file and adds them to the kyboard buffer
parameter1
Parameters depend on the opcode.
Return Code:
returnCode can be any signed numeric data item. The meaning depends on the opcode.
Examples:
Example - Send some keystrokes to the standard input
 move "This is an automatic text" to txt-string
 inspect txt-string replacing trailing spaces by low-values
 perform varying i from 1 by 1  
           until txt-string(i:1) = low-value
         call "w$keybuf" using 2, txt-string(i:1
 end-perform.