Version 4.5.2
 —  Commands  —

IF/IFNOT

Description

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.

Syntax

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.

Syntax for *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.

Examples

Procedure File Examples

Findfile.ncp, Copyscr.ncp

Variables Returned

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)

Related Commands

WAITFOR

Usage

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

Top of page