Skip to main content

This is documentation for Caché & Ensemble.

For information on converting to InterSystems IRIS, see the InterSystems IRIS Adoption Guide and the InterSystems IRIS In-Place Conversion Guide, both available on the WRC Distributions page (login required).

Previous sectionNext section


Performs an equality comparison on elements of two dynamic arrays.




dynarray An expression that resolves to a dynamic array of numeric values.


The EQS function compares each corresponding numeric element from two dynamic arrays for equality. It returns a dynamic array of boolean values, in which each element comparison is represented by a 1 (equal) or a 0 (not equal). EQS converts numeric values to canonical form, removing signs and leading and trailing zeros, before making the comparison. EQS does not convert numeric strings to canonical form before making the comparison. If an element is missing, or has a null string value or a non-numeric value, EQS assigns it a value of 0 for the purpose of this comparison.

For two elements to be compared, they must be on the same dynamic array level. For example, you cannot compare a value mark (@VM) dynamic array element to a subvalue mark (@SM) dynamic array element.

If the two dynamic arrays have different numbers of elements, the returned dynamic array has the number of elements of the longer dynamic array. By default, unmatched elements return 0 (not equal). That is, the EQS comparison of each element in the longer dynamic array that has no corresponding element in the shorter dynamic array always returns 0 (not equal), even when the value of the longer array element is 0 or the null string, or is a missing element within the dynamic array. You can also use the REUSE function to define behavior when specifying two dynamic arrays with different numbers of elements.

The EQS function is the functional opposite of the NES function.


The following example uses the EQS function to return an equality comparison for each of the elements in dynamic arrays a and b:

      ! returns 1ý0ý0ý1
Copy code to clipboard

The following example compares various element values to 0:

      ! returns 1ý1ý1ý1
Copy code to clipboard

See Also