Neoview Command Interface (NCI) Guide (R2.5)

IF...THEN Command
IF...THEN statements allow for the conditional execution of actions. If the condition is met, the
action is executed; otherwise, no action is taken.
Syntax
IF {condition} THEN {action} {SQL-terminator}
Condition Parameter
The condition parameter (condition) is a Boolean statement structured as follows:
{variable-name|value}{operator}{variable-name|value}
variable-name
is one of:
{ LASTERROR
| RECCOUNT
| ACTIVITYCOUNT
| ERRORCODE
| [%]any ENV variable|any SQL parameter }
value
is any integer or a quoted string, where the quoted string is any non-quote character. \ is the
optional escape character.
operator
is one of:
MeaningOperator
equal to
== | =
not equal to
<> | != | ~= | ^=
greater than
>
greater than or equal to
>=
less than
<
less than or equal to
<=
Action Parameter
The action parameter (action) is any NCI or Neoview SQL command.
SQL Terminator
The SQL terminator (SQL-terminator) is the default terminator (;) or a string value defined
for the statement terminator by the “SET SQLTERMINATOR Command” (page 122). See “Setting
and Showing the SQL Terminator” (page 48).
Considerations
IF...THEN is itself an action. Thus, nested IF...THEN statements are allowed.
An action must end with the SQL terminator, even if the action is an interface command.
Examples
These commands show multiple examples of IF...THEN statements:
90 NCI Commands