NE is the keyword spelling for not equal—the inverse of EQ in Broadcom relational operator tables. IF STATUS NE X keeps processing when status differs from X. IF ERROR-CODE NE 0 drives exception reports. IF NEW-AMT NE OLD-AMT extracts changed pay records between cycles. Legacy mainframe shops standardized NE alongside EQ LT GT GE LE because keywords survive noisy line printers and code walkthroughs without punctuation ambiguity. Symbolic <> expresses the same test; NE matches manual headings exactly. NE never assigns values—it only evaluates true or false inside conditions. Beginners overuse NE for long exclusion lists that become unreadable; sometimes EQ with THRU or positive inclusion filters maintain better. This page teaches NE syntax, equivalence with <>, numeric and alphabetic inequality, field-to-field change detection, logical combinations, contrast with NOT EQ, and audit-friendly exclusion patterns for batch Easytrieve jobs.
NE appears between operands in IF, ELSE-IF, DO WHILE, and nested JOB conditions. IF DEPT NE 999 includes every department except nine-nine-nine. IF REC-STATUS NE D skips detail lines when building a summary-only extract. IF TAX NE 0 flags rows with tax withheld. The operator does not modify operands—it gates PRINT, PUT, assignment blocks, or procedure calls in the THEN path.
12345678JOB INPUT PAYROLL IF ERROR-CODE NE 0 PRINT EXCEPTION-RPT END-IF IF REGION NE 99 PRINT REGION-DETAIL END-IF
| Form | Example | Notes |
|---|---|---|
| Keyword NE | IF STATUS NE X | Broadcom manual spelling |
| Symbolic <> | IF STATUS <> X | Same test—see Not equal page |
| NOT EQ | IF NOT STATUS EQ X | Logically related—prefer NE for clarity |
| NE zero | IF AMT NE 0 | Common non-zero filter pattern |
Exclusion rules often phrase as anything except: all regions except corporate rollup ninety-nine, all statuses except terminated T, all accounts except closed zero balance when zero means closed. NE maps directly. Change detection compares current to prior: IF CURR-KEY NE PRIOR-KEY after reading previous record in sorted duplicate logic. Error surfacing uses IF CODE NE 0 because zero conventionally means success. Positive inclusion with EQ sometimes reads clearer—IF STATUS EQ A OR STATUS EQ P for active and pending— when the allowed set is small. NE chains for many exclusions become hard to audit; ref actor to lookup flags in Library when exclusion lists grow.
IF BALANCE NE 0 includes overdraft and credit—anything not exactly zero. IF RATE NE STANDARD-RATE flags pricing exceptions. Implied decimal scales apply as with EQ: P 2 compares monetary values, not display pictures. IF COUNT NE PRIOR-COUNT detects volume shifts between runs. Signed negatives compare with sign intact: IF ADJ NE -100 passes when adjustment differs from negative one hundred. NE with zero is among the most common production patterns because zero often encodes no error, no tax, or no activity.
IF STATUS NE T keeps non-terminated employees. Trailing spaces matter: IF NAME NE SMITH compares full fixed field including pads—ARNOLD with trailing space NE SMITH literal may be true even when business names match visually. Quote literals to declared lengths for single-character codes. Case follows collating rules—IF CODE NE abc differs from IF CODE NE ABC when case is significant. Blank-padded fields compared to empty-looking literals trip beginners who expect trim semantics NE does not provide.
12345678910FILE EMPLOYEE FB(80 800) STATUS 72 1 A DEPT 73 3 N JOB INPUT EMPLOYEE IF STATUS NE 'T' IF DEPT NE 999 PRINT ACTIVE-EXCL-CORP END-IF END-IF
IF NEW-ADDR NE OLD-ADDR extracts address changes. IF CURR-GROSS NE PRIOR-GROSS drives pay-change notices. IF BATCH-ID NE PREV-BATCH detects file boundary in concatenated inputs. Types and lengths must align; comparing partial fields may require substring definitions in Library. NE between numeric and alphabetic without conversion is invalid or misleading—define working fields with explicit moves first.
IF STATUS NE X AND STATUS NE Y excludes two statuses—equivalent to neither X nor Y when both must fail for exclusion. IF REGION NE E OR REGION NE W is always true for any single region value—a common logic bug; use AND for excluding both coasts simultaneously or restructure with EQ inclusion lists. Parentheses clarify intent: IF (CODE NE A) AND (CODE NE B). Combine NE with LT GT for band gaps: IF SCORE NE 0 AND SCORE LT 60 for failing non-zero scores only—unusual but valid when zero means not tested.
IF DEPT NE 911 includes all departments except nine-one-one. IF DEPT EQ 100 OR DEPT EQ 200 includes only two departments. Choose NE when exclusion set is small; choose EQ inclusion when allowed set is small. Auditors reading NE must infer everything else passes—document intent in comments when exclusion semantics affect compliance reports.
NE cost per record is one compare—negligible versus I/O. No sort requirement for simple threshold NE tests. Duplicate detection IF KEY NE PRIOR-KEY often pairs with sorted input so PRIOR-KEY holds the previous row—pattern choice, not operator requirement.
NE means not the same. The teacher says everyone who is not wearing red shoes goes to the playground. Red-shoe kids stay inside. That is NE—you are checking who does not match one thing. It is the opposite of EQ, which asks who matches. If your name tag has extra spaces, NE might think you are different from a name without spaces even when it is still you.
1. IF STATUS NE X means:
2. NE and <> in IF DEPT NE 999 versus IF DEPT <> 999:
3. IF ERROR-CODE NE 0 is typical for:
4. NOT STATUS EQ X compared to STATUS NE X:
5. IF NEW-AMT NE OLD-AMT detects: