IFN
Performs numeric comparisons and allows conditional execution of Proc commands.
Syntax
IFN reference operator expression command
Syntax Elements
reference precedes the operator and can be one of the following:
A valid form of the A command, except that with a surround character.
The A command does not move a value as it does when used alone. The A command is used in an IF command to specify which input buffer parameter is to be tested.
Refer to the description of the A command for information on which input buffer parameter the A command references.
A direct or indirect reference to a buffer or select register, or a SYSTEM function.
operator performs a value comparison. The operators are:
< Less than.
> Greater than.
[ Less than or equal to.
] Greater than or equal to.
expression follows the operator and can be one of the following:
- A direct or indirect reference to a buffer or select register.
A string containing one or more nonblank characters.
If the string contains embedded blanks or the first character is an exclamation mark (!), it must be enclosed in single or double quotes.
- A valid Proc command.
Operation
Use the IFN command when the values to be tested are numeric and you are using operators other than equal to (=) and not equal to (#).
IFN allows numbers to be ranked correctly by their values, not by their ASCII equivalents.
The values (up to the first nonnumeric character) are converted to binary, and the first value is compared algebraically with the second.
If a value is null or starts with a nonnumeric character, a zero is used, except that a leading plus or minus sign is valid.
A decimal point can be part of the value, but it is skipped during the compare. For example, 1.23 is evaluated as 123.
Examples
IFN %2 > &2.7 G 33
If the 2nd parameter of the primary input buffer is greater than the 7th attribute in file buffer 2, control transfers to statement label 33.
IFN %2 ] %1 GOSUB 14
If the 2nd parameter in the primary input buffer is greater than or equal to the 1st parameter, control transfers to subroutine 14.
IFN A < 0 GO 55
If the current parameter is less than 0, control passes to statement label 55.