IF
checks a condition.
IFNOT
is short for IF *SCREEN
NE
.
If the condition is true, the statement is executed. If the condition is false, the next statement is executed.
Text enclosed in single or double quotation marks is case-sensitive.
IF [variable] [operator] variable command
IFNOT variable command
For variable, you can use any of the
variables provided by Entire Connection (e.g.
#PARM1
or #CNT1
).
When dealing with mainframe applications, the
*SCREEN
variable (syntax see below) is useful to
determine which screen is currently being transmitted without having to display
it. You can then react as required.
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
If you omit the optional operands variable
and operator in an IF
statement, the variable *SCREEN
(whole screen) and
the operator EQ
are used.
*SCREEN
The variable *SCREEN
can only be used once
per IF
/IFNOT
.
*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.
Search the whole screen for NEXT
. If NEXT
is
found, branch to the NEXT
tag:
IF 'NEXT' GOTO NEXT
Search the whole screen for NEXT
. If NEXT
is
not found, branch to the CONTINUE
tag:
IFNOT 'NEXT' GOTO CONTINUE
Search the next 4 positions for NEXT
, starting in row 2
and column 1:
IF *SCREEN 2 1 4 EQ 'NEXT' GOTO CONTINUE
Search the next 80 positions for NEXT
, starting in row 2
and column 1:
IF *SCREEN 2 1 80 EQ 'NEXT' GOTO CONTINUE
Search for the contents of the local variable
#PARM1
, starting in the row defined by the
+ROW
variable and the column defined by the
+COL
variable; the number of positions to be
searched is defined by the value of the #CNT3
variable:
IF *SCREEN +ROW +COL #CNT3 EQ #PARM1 GOTO CONTINUE
Send the defined keyboard input to the host, if the content of the
local variable #PARM1
is not blank:
IF #PARM1 NE '
' TYPE '*NAT' CR
Findfile.ncp, Copyscr.ncp
If the condition for the command IF *SCREEN
EQ
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)
Procedure File: | Yes |
Command Line: | No |
Key: | No |
API: | Yes |