Range Check Conversion (R)

Range Check Conversion (R)

Top  Previous  Next

 

The R conversion code checks whether a numeric value is within a specified range.

 

The full format of this conversion code is

 

Rn,m{;n,m...}

 

where

 

n,mspecifies a range of numeric values. Negative values are allowed. If more than one n,m pair is supplied, they may be separated by semicolons (;) or forward slashes (/).

 

 

The R conversion code tests whether the input data is an integer value in the range n to m. If the value is within the specified range, the conversion returns the input data. If the value is outside the range, a null string is returned.

 

If more than one n,m pair is provided, the input value is tested against each in turn.

 

A null input value always returns a null result regardless of the values of n and m.

 

A non-numeric data item will return the original data. The STATUS() function would then return 1 to indicate an error.

 

 

Examples

 

Conversion

Data

Result

R3,5

1

 

R3,5

3

3

R-2,0

-3

 

R-2,0

-1

-1

R1,3;6,8

7

7

R1,3;6,8

5

 

R1,3

0002

0002

R1,3

 

 

R1.3

A

A