Comparison operations
About this task
The comparison operators compare two terms and return the value 1 if the result of the comparison is true, or 0 if the result is false.
The comparison operators and operations are:
- =
- True if the terms are equal (numerically or when padded, and so forth)
- \=, ¬=, /=
- True if the terms are not equal (inverse of =)
- >
- Greater than
- <
- Less than
- ><
- Greater than or less than (the same as not equal)
- <>
- Greater than or less than (the same as not equal)
- >=
- Greater than or equal to
- \<, ¬<
- Not less than
- <=
- Less than or equal to
- \>, ¬>
- Not greater than
- ==
- True if the terms are strictly equal (identical)
- \==, ¬==, /==
- True if the terms are not strictly equal (this is the inverse of ==)
- >>
- Strictly greater than
- <<
- Strictly less than
- \<<
- Strictly not less than
- \>>, ¬>>
- Strictly not greater than
A character string has the value false if it is 0, and true if it is 1. The logical operators take one or two such values (values other than 0 or 1 are not allowed) and return 0 or 1 as appropriate:
| & | AND | Returns 1 if both terms are true |
| | | OR | Returns 1 if either term is true |
The instruction can be one of the following:
| ADD | ADDOP | ADDPRED | ADDRES | CALL |
| CHGEXTNAME | CHGJOB | CHGOPSAI | CHKAPPL | CHKDATE |
| COMPL | DEL | DELPRED | DELRES | EXIT |
| FORCE | GOTO | HOLD | IF-THEN-ELSE | INIT |
| JSUACT | LABEL | MODOP | NOP | OPSTAT |
| RELEASE | RELOP | RELSUCC | SET | SETUPD |
| SRSTAT | UNNOP | UPD | WSSTAT | WTO |
Here are some examples:
IF RESULT = 8 THEN EXIT 70; ELSE COMPL APPL(TEST01)
IF LEFT(&VAR1,1) = 1 THEN ADD APPL(TEST01)
IF substr(VAR1,5,2) = 'XX' then COMPL APPL(TEST02)
IF VAR4 = VAR1||VAR2||VAR3 THEN UPD VAR4
IF VAR5 > VAR4 THEN SET VAR6 = VAR3 + 2
IF substr(&OYMD1,3,4) = '0612' THEN goto GIU12
IF &OHHMM > '1830' THEN GOTO T1830The IF instruction
returns one of the following return codes:
- CC = 0
- Instruction correctly processed
- CC = 8
- Syntax error