IS [NOT] EQUAL TOExample #1:I want to count the number of full time employees. On my employee file, full time employees are designated with a F in the column called TYPE-EMP. Notice that the IF is terminated with a period (later in this handout we will look at END-IF as an alternative).
IS [NOT] =
IS [NOT] GREATER THAN
IS [NOT] >
IS [NOT] LESS THAN
IS [NOT] <
IS GREATER THAN OR EQUAL TO
IS >=
IS LESS THAN OR EQUAL TO
IS <=
Example #1 | IF TYPE-EMP = "F" ADD 1 TO EMP-CT END-IF. |
Example #2 | IF TYPE-EMP = "F" ADD 1 TO FULL-CT MOVE "FULL TIME" TO MSG-PR MOVE SALARY TO PAY-PR END-IF. |
Example #3 | IF TYPE-EMP = "F" PERFORM B-300-FULL-TIME END-IF. |
Example #4 | IF TYPE-EMP = "F" ADD 1 TO FULL-CT ELSE ADD 1 TO OTHER-CT END-IF. |
Example #5 | IF TYPE-EMP = "F" ADD 1 TO FULL-CT MOVE "FULL TIME" TO MSG-PR MOVE SALARY TO PAY-PR ELSE ADD 1 TO OTHER-CT MOVE "NOT FULL TIME" TO MSG-PR MULTIPLY PAY-HR BY HOURS GIVING GROSS-WS MOVE GROSS-WS TO PAY-PR END-IF. |
Example #6 | IF TYPE-EMP = "F" PERFORM B-300-FULL-TIME ELSE PERFORM B-310-NOT-FULL-TIME END-IF. |
CLASS-CODE = "B" AND ON-HAND >100 OR ON-ORDER > 100 |
Since AND is resolved before OR, this would read as CLASS-CODE = "B" AND ON-HAND > 100 OR just ON-ORDER > 100 - Not what we want! |
CLASS-CODE = "B" AND (ON-HAND > 100 OR ON-ORDER > 100) |
Since parenthesis resolve first, this will combine the CLASS-CODE = "B" with either of the other - Exactly what we want! |