Data editing > Expressions > Logical expressions > Checking the arithmetic value of a field of columns
 
Checking the arithmetic value of a field of columns
Quick reference
To test whether a value in a field is within a specified range, type:
range(start,end,minimum,maximum)
Blanks at the start of the field cause this statement to give a false result. To ignore leading blanks, type:
rangeb(start,end,minimum,maximum)
More information
The logical expression range checks whether the number in a field of columns is within a given range. If so, the expression is true, otherwise it is false. The format of this statement is:
range(start,end,min,max)
start and end are column numbers, and min and max are the range delimiters. For example, the statement:
range(137,139,100,150)
returns the value true if the number in columns 37 to 39 of card 1 is in the range 100 to 150.
Note This statement is designed for use with purely numeric columns. Columns which contain blanks, multicodes or an ampersand (12 punch) automatically cause the statement to be false. The exception to this is a multicode of a digit and a minus sign (11 code) which converts the whole field to a negative number.
A variation of range is rangeb which allows columns to the left of the field to be blank if the number is right-justified in the field. In all other respects it is exactly the same as range. If the data is:
----+----2
   123 6
the expression:
rangeb(17,18,1,10)
is true because the string $ 6$ is read as 6. With range, the value would be false.
However, the expression:
rangeb(15,18,2000,3000)
returns false because of the blank in c17.
See also
Logical expressions