Operators are the punctuation of Easytrieve logic—comparing department codes, combining conditions, moving values between fields, and adding totals. This cheat sheet lists relational, logical, assignment, and arithmetic operators with plain-language meaning, typical IF examples, and pitfalls beginners hit when types or lengths do not match. Print it beside your terminal or bookmark it during code review. Each row links mentally to dedicated operator tutorials in this site for precedence, EOF tests, and migration notes. Broadcom Report Generator 11.6 follows classic Easytrieve expression rules; verify edge cases in your compile listing when upgrading.
Relational operators compare two values in IF, DO WHILE, and similar expressions. They return true or false for the condition. Numeric fields compare by numeric value; alphanumeric fields compare by character sequence (collating sequence on mainframe). Mixed-type compares follow Language Reference conversion rules—prefer explicit types in DEFINE and FILE to avoid surprises.
| Operator | Alternate | Meaning | Example |
|---|---|---|---|
| EQ | = | Equal | IF DEPT EQ 911 |
| NE | ¬= / <> | Not equal | IF STATUS NE 0 |
| GT | > | Greater than | IF GROSS GT 0 |
| LT | < | Less than | IF COUNT LT 100 |
| GE | >= | Greater or equal | IF DATE GE WS-START |
| LE | <= | Less or equal | IF QTY LE MAX-QTY |
Logical operators combine multiple conditions. AND requires all parts true. OR requires at least one part true. NOT inverts a condition. Complex filters use parentheses where your release supports grouping—document non-obvious logic in comments. Short-circuit behavior may differ by release; do not rely on side effects in unused branches.
| Operator | Meaning | Example |
|---|---|---|
| AND | All conditions must be true | IF DEPT EQ 911 AND GROSS GT 0 |
| OR | At least one condition true | IF REGION EQ 1 OR REGION EQ 2 |
| NOT | Reverse condition | IF NOT EOF PAYROLL |
1234567IF DEPT EQ 911 AND GROSS GT 50000 PRINT HIGH-PAY-RPT END-IF IF REGION EQ 'E' OR REGION EQ 'W' PERFORM REGION-TOTAL END-IF
MOVE copies from source to target. Assignment statements may use = in some expression contexts per release. Watch length—moving long alphanumeric to shorter field truncates. Moving numeric to alphanumeric may require edit masks or conversion. Multiple targets can sometimes receive the same source in one statement depending on grammar. See assignment and MOVE tutorials for COBOL migration differences.
| Form | Use |
|---|---|
| MOVE TARGET SOURCE | Copy field or literal to TARGET |
| MOVE A B C | Multiple targets from one source where allowed |
| TARGET = expression | Assign result of expression where supported |
| ADD A B | Add B into A (accumulator patterns) |
Addition, subtraction, multiplication, and division appear in assignment expressions and ADD statements. Packed decimal fields preserve scale when defined with decimals. Division by zero causes runtime errors—guard with IF. Rounding follows packed rules; financial apps document half-up expectations in comments.
| Operator | Meaning | Note |
|---|---|---|
| + | Add | ADD statement or expression |
| - | Subtract | Watch packed sign |
| * | Multiply | Overflow on small fields |
| / | Divide | Test divisor not zero |
| Test | Meaning |
|---|---|
| EOF file | End of file reached on named file after read |
| HIGH-VALUES | Compare to maximum collating value constant |
| LOW-VALUES | Compare to minimum collating value constant |
| SPACE / SPACES | Blank alphanumeric test in conditions |
Deep dives: EQ, NE, GT, LT, GE, LE, AND, OR, NOT, MOVE, assignment under /operators/ in this tutorial. Use those pages for migration quirks and report writer interactions.
Operators are question words and actions. EQ asks are these the same? GT asks is this bigger? AND means both questions must be yes. MOVE means copy this sticker to that box. The cheat sheet is the small card on the desk so you do not forget the question words while doing homework.
1. EQ and = in Easytrieve both mean:
2. IF A GT 0 AND B LT 100 requires:
3. NE means:
4. MOVE TARGET SOURCE:
5. NOT in logical expressions: