The condition following the word WHEN can test only for equality:
Valid: WHEN T-CUSTOMER-NO (X1) = CUST-NO-IN
Invalid: WHEN T-WEIGHT-MAX (X1) < WEIGHT-MAILED
If the condition following the word WHEN is a compound conditional:
a. Each part of the conditional can only consist of a relational test that involves an equal condition.
b. The only compound condition permitted is with ANDs, not ORs.
Valid: WHEN S-AMT (X1) = AMT1 AND TAX-AMT (X1) = AMT2
Invalid: WHEN SALES-AMT (X1) = AMT3 OR AMT4 = AMT5
Only one WHEN clause can be used with a SEARCH ALL.
The VARYING option may not be used with the SEARCH ALL.
The OCCURS item and its index, which define the table argument, must appear to the left of the equal sign.
Valid: WHEN S-AMT (X1) = AMT1…
Invalid: WHEN AMT1 = S-AMT (X1)…