WAITFOR

Description

Wait for a specific condition on the terminal emulation screen that will be sent by the host.

If the condition is true, the corresponding statement is executed.

If the condition is false, or if the time period defined in the system variable RESPONSE has exceeded without receiving a screen from the host, the next statement is executed.

Syntax

WAITFOR screenvariable operator string command

screenvariable represents the variable *SCREEN (syntax see below).

operator is one of the following:

EQ equal
NE not equal
GE greater than or equal to
LE less than or equal to
GT greater than
LT less than

For command, you can use any Entire Connection command except the following:

IF
IFNOT
WAITFOR

Syntax for *SCREEN

The variable *SCREEN can only be used once per WAITFOR.

*SCREEN [row column [length]]

row is a value between 1 and the maximum number of lines +1.

column is a value between 1 and the maximum line size.

length is a value between 1 and the screen size.

For example:

*SCREEN means the whole screen.

*SCREEN 2 1 means from row 2, column 1 to the end of the screen.

*SCREEN 2 1 80 means from row 2, column 1, the next 80 positions.

Examples

  • Check whether the string CP READ occurs on the screen and, if the condition is true, branch to the LOGON tag:

    WAITFOR *SCREEN EQ 'CP READ' GOTO LOGON
  • Check whether the string NEXT occurs on the screen, starting in row 2, column 1, and, if the condition is true, send CR to the host:

    WAITFOR *SCREEN 2 1 EQ 'NEXT' TYPE CR
  • Check the value defined in the local variable #PARM1 and, if the condition is true, branch to the CONTINUE tag:

    WAITFOR *SCREEN EQ #PARM1 GOTO CONTINUE

Procedure File Example

Waitcmds.ncp

Variables Returned

If the condition is true, the screen position of the string is returned in the following local variables:

#ROW - valid values are between 1 and the maximum number of lines +1

#COL - valid values are between 1 and the maximum line size

Related Commands

IF, PAUSE, SLEEP, WAIT, WAITM

Usage

Procedure File: Yes
Command Line: No
Key: No
API: No