Simulating cursor movement
Simulating movement on a panel is especially useful when your simulated terminal is interacting with a full-screen application such as Interactive System Productivity Facility (ISPF). These applications usually define certain areas of the screen as fields that will accept operator input. The operator must move the cursor to these fields using the cursor movement keys, tab keys or some other key that alters the cursor location, such as NL for a new line.
You can also position the cursor with the CURSOR statement. You can use this statement to simulate the arrow keys or to place the cursor where you want it without simulating keys.
You can use the CURSOR statement either to position the cursor
at an absolute screen location or to move the cursor up, down, left,
or right relative to its current location. The syntax for this statement
follows:
CURSOR({integer_expression}[,integer_expression])
{direction}
If you use two integer
expressions, the first is the row and the second is the column. If
you use one of the directional words ("UP", "DOWN", "LEFT",
or "RIGHT") with an integer, the cursor moves the given
number of characters in the specified direction. If you use an integer
alone, the cursor is positioned at that offset into the screen.The following examples position the cursor at the locations given.
cursor(1,1) /* Positions cursor at row 1, column 1. */
cursor(1000) /* Positions cursor at screen offset 1000. */
row_number = 12
column_number = 40
cursor(row_number,column_number + 5) /* Positions cursor at row 12, */
/* column 45. */
The
following examples move the cursor relative to its current screen
location.
cursor("up") /* Moves cursor up one row. */
cursor("down",5) /* Moves cursor down 5 rows. */
count = 20
cursor("right",count*3) /* Moves cursor right 60 columns. */
The
following statements show the different ways that device key statements
can be coded to move the cursor. For example, to place the cursor
at the beginning of the third input field on the current screen, you
could code:
home
tab
tab