The equals sign wears two hats in Easytrieve. In a standalone assignment statement it stores a value—NET = GROSS - TAX. Inside an IF condition it asks a yes-or-no question: is this field equal to that value? That second role is the symbolic equal operator documented on this page. Broadcom Getting Started examples use IF DEPT = 911 to filter personnel records before PRINT. Beginners stumble when they use = for assignment inside IF or EQ for assignment on a plain statement line—the compiler error messages distinguish context, but understanding the dual role prevents hours of debugging. Equality comparisons drive payroll exception reports, status routing, duplicate detection, and control-break prerequisites. This page teaches symbolic = syntax, the EQ keyword synonym, numeric versus alphabetic equality rules, field-to-field tests, interaction with THRU ranges, common space-padding traps, and patterns that keep batch filters correct on production files.
Equality testing uses = between two operands inside IF, ELSE-IF, DO WHILE, or nested conditions within procedural logic. IF STATUS = A branches when the STATUS field equals literal A. IF DEPT = 911 matches Broadcom filtered-report tutorial syntax. IF EMPNO = HOLD-EMP compares two fields for the same stored value. The operator does not modify either operand—it evaluates to true or false for the enclosing condition.
12345678JOB INPUT PERSNL IF DEPT = 911 PRINT PAY-RPT END-IF IF STATUS = 'A' AND GROSS = 0 PRINT EXCEPTION-RPT END-IF
Broadcom Language Reference documents relational operators in both symbolic and keyword form. IF STATUS = Y and IF STATUS EQ Y express the same equality test in most installations. Keyword EQ removes ambiguity with assignment in code reviews—readers never confuse IF STATUS EQ Y with STATUS = Y on an assignment line because assignment never appears inside IF without the IF wrapper. Symbolic = feels natural to developers from SQL or algebra. Pick one spelling per project style guide; mixing both in one program works but hurts readability.
| Form | Example | When to use |
|---|---|---|
| Symbolic = | IF DEPT = 911 | Matches math notation; requires IF context |
| Keyword EQ | IF DEPT EQ 911 | Unambiguous in manuals and code review |
| Assignment = | FLAG = Y | Not comparison—stores into FLAG |
STATUS = A on its own statement line assigns literal A into STATUS. That is the assignment operator covered on the dedicated assignment page. IF STATUS = A never assigns—it only tests. A classic beginner bug codes IF STATUS = A expecting to set status, but the condition runs only when STATUS already equals A. To store, use STATUS = A as a procedural statement outside IF or in the THEN branch: IF VALID = Y; STATUS = A; END-IF patterns vary by release grammar—verify terminator rules for your compiler.
Packed P fields, zoned N fields, and binary B fields compare by numeric value, not by display editing. IF GROSS = 0 skips zero-pay records. IF TAX = FED-TAX detects matching tax components between two fields. Implied decimals participate: P 2 field storing 10.00 equals literal or field representing ten dollars and zero cents when scales align. Comparing P 2 to N 5 may convert per product rules—test with DISPLAY in development before trusting cross-type equality in production.
Signed values compare with sign nibble intact. IF BALANCE = -100 requires literal or field representing negative hundred in the type system your DEFINE uses. LOW-VALUES and HIGH-VALUES constants compare equal only to themselves and documented special cases—not to business zero unless your site initialization maps them that way.
Fixed-length alphabetic fields pad with spaces to the right. EMPNAME defined A 8 holding ARNOLD occupies ARNOLD followed by one space. IF EMPNAME = ARNOLD may fail if the literal is shorter and comparison does not trim—literal ARNOLD in quotes may need length matching field padding conventions. Use documented TRIM, substring, or edited derived fields when business rules ignore trailing blanks. Case sensitivity depends on site and field definition—IF CODE = abc differs from IF CODE = ABC when collating treats case distinctly.
12345678FILE PERSNL FB(150 1800) EMPNAME 17 8 A STATUS 99 1 A JOB INPUT PERSNL IF STATUS = 'A' PRINT ACTIVE-RPT END-IF
IF SHIP-DEPT = HOME-DEPT routes transfers when department codes match. IF PRIOR-GROSS = GROSS detects unchanged pay amounts between cycles. IF KEY-A = KEY-B supports duplicate detection when both keys should differ. Operand types should be compatible—comparing A 10 to A 3 may compare only overlapping length or promote per grammar; verify in Language Reference for your release. Mismatched types between alphabetic and numeric without conversion yield compile errors or unexpected false results.
Equality combines with THRU for inclusive range membership: IF SERVICE EQ 6 THRU 10 is true for 6, 7, 8, 9, and 10. That is not a single = test but a related relational pattern beginners meet alongside equality. Single-value = tests one point; THRU tests interval. Use = for exact codes—department 911 only. Use THRU for banded categories— service years six through ten.
DO WHILE EOF = N continues until end-of-file constant matches. IF A = B AND C = D requires both equalities true when AND binds conditions. Parentheses clarify: IF (A = B) OR (C = D). NOT wraps equality: IF NOT STATUS = X processes everyone except status X per NOT precedence rules on logical expressions page. Mixing = with GT or LT in one condition is valid: IF AGE = 65 OR AGE GT 65 simplifies to IF AGE GE 65 when you prefer one operator.
Primary equality use is JOB procedural filtering before PRINT or PUT. Some report or edit contexts accept relational tests per release—confirm grammar before coding = in REPORT PROC conditions. Selection files often pre-filter in JOB: IF REC-TYPE = D PRINT DETAIL-RPT; IF REC-TYPE = S PRINT SUMMARY-RPT. Consistent single-character codes in A 1 fields make = tests fast and readable.
Equality test cost is negligible per record—one compare per IF. Millions of records with dozens of IF chains still spend most time in I/O. Equality does not require sorted input unlike CONTROL breaks. Duplicate detection IF KEY = PRIOR-KEY benefits from sorted input so PRIOR-KEY tracks previous record—logic pattern not operator requirement.
The equals sign in a question means same. Is your shirt color the same as the blue crayon? If yes, we put you in the blue team line. If no, you go somewhere else. That question is different from handing you a blue crayon—that is assignment, giving you the crayon to hold. Easytrieve uses the same squiggle for both jobs, but it knows whether you are asking a question inside IF or giving a field a new value on its own line. Spaces at the end of a name tag count—ARNOLD with an extra blank space is not exactly ARNOLD without it.
1. IF DEPT = 911 tests:
2. EQ and = in IF STATUS EQ Y versus IF STATUS = Y:
3. Comparing alphabetic field to literal requires attention to:
4. IF GROSS = LIMIT compares:
5. Using = in TARGET = EXPRESSION without IF is: