%RANGE (lower-limit : upper-limit)
%RANGE is used with the IN operator. %RANGE does not return a value, and it cannot be specified anywhere other than following the IN operator.
When the IN operator is used with %RANGE, it determines whether the first operand is in the range specified by %RANGE.
The expression using the IN operator with %RANGE is true if the first operand of the IN operator is greater than or equal to the first operand of %RANGE and less than or equal to the second operand of %RANGE.
The first operand of the IN operator cannot be an array.
The operands of %RANGE must be able to be compared to each other and to the first operand of the IN operator. For example, if the first operand of the IN operator has type date, the operands of %RANGE must also have type date.
IF x IN %RANGE(y1 : y2); IF x >= y1 AND x <= y2;
DCL-S string CHAR(1000); DCL-S p1 POINTER; DCL-S p2 POINTER; DCL-S p3 POINTER; p1 = %ADDR(string) + 10; p2 = %ADDR(string) + 50; p3 = %ADDR(string) + 75; IF p2 IN %RANGE(p1 : p3); DSPLY ('true'); ENDIF;