# MATCH
> [HTML Version](matchsbr.htm)
**xcall MATCH, rtncod, value, range**
MATCH is useful in building flexible record selection logic. With it, you can easily allow the users to specify a list of acceptable values, or ranges of values, for a particular field. Then for each candidate record, just pass the value and range specification to the subroutine and let it worry about numeric, string, and date comparisons.
**Parameters**
_rtncod_ (Signed [Num](num.htm.md))
returns the results:
| **Value** | **Meaning** |
|------|------|
| 0 | No match; value is not within the specified list or range |
| 1 | Match; value is within range |
| \-1 | Parameter error |
| \-2 | Value type not supported |
| \-3 | Range string too long |
| \-4 | Syntax error in range |
_value_ (F,6, ([String](string.htm.md)), or B#)
is the value which you want to check against the range.
_range_
is the range specification in the form:
r1,r2,r3,...,rn
Each of the _rx_ entries in the range string may be either a single value or a from-to range expressed as a beginning and ending value, separated by a dash. Each item in the range list is interpreted according to the type of the _value_ parameter. String entries are case sensitive. If both _value_ and _range_ are of type string, and _value_ is in the form:
mm/dd/ccyy
then each entry in the _range_ string is interpreted as a date in a similar format. mm/yy is interpreted as mm/01/ccyy if followed by a dash, or mm/31/ccyy if preceded by a dash. The cc value is assumed to be 19 unless specified or unless the SBR=CCYY:## setting in miame.ini has been established.
On return, _range_ is converted into a "compiled" format to eliminate the need for parsing it out on the next call. (If used for file record selection, you would typically be calling this routine hundreds or even thousands of times, with different _value_ parameters but the same (or a limited number of) _range_ strings.
A NULL _range_ string matches all, as does a NULL _value_ (for String ranges). Examples:
| **Range String** | **Meaning** |
|------|------|
| "AA-CZ,F,JA\*" | Match any string starting with "AA" through "CZ" ("ABCD" matches, "CZ1" does not). Also match if Value = "F", or if it equals anything starting with "JA". |
| "91300-91399,93132,95555" | Match any number 91300 through 91399, or match 93132 or 95555. |
| "03/15/97,04/17-2/18,3/02/2025" | Date match, including 15 March 1997, or 1 April 1 2017 through 28 Feb 2018, or 2 March 2025, assuming SBR=[CCYY](ccyy.htm.md):## with 18 < ## < 97. |