Rules for Multiple Comparisons - mfx - 3.1

Syncsort™ MFX Programmers Guide

Product type
Software
Portfolio
Integrate
Product family
Syncsort™ Software
Product
Syncsort™ MFX > MFX
Version
3.1
Language
English
Content type
Programmer’s Guide
Product name
Syncsort™ MFX
Title
Syncsort™ MFX Programmers Guide
Topic type
How Do I
Copyright
2024
First publish date
2010
Last edition
2024-08-27
Last publish date
2024-08-27T08:14:56.318001

Multiple comparisons are separated by ANDs or ORs to form a logical expression. (Alternatively, & and | may be used for AND and OR). When evaluating an expression, each comparison cn is evaluated first. Then, AND conditions are evaluated before OR conditions.

Parentheses may be used around groups of comparisons to change the default evaluation order. Any number of nested parentheses may be used. Conditions within parentheses are evaluated first, from innermost to outermost parentheses.

For example, if you wanted to select all records from your Paris office for 1995 and 1996, you might incorrectly specify:
INCLUDE COND=(1,4,CH,EQ,C'1995',OR,1,4,CH,EQ,C'1996', AND,5,5,CH,EQ,C'PARIS')
The AND operator in the above statement would be evaluated first, producing unexpected output. The correct statement would be:
INCLUDE COND=((1,4,CH,EQ,C'1995',OR,1,4,CH,EQ,C'1996'), AND,5,5,CH,EQ,C'PARIS')

The added parentheses force the OR operator to be evaluated first, thus producing the expected output.