Coding conditional expressions
Using the IF
and EVALUATE
statements,
you can code program actions that will be performed depending on the
truth value of a conditional expression.
You can specify the following conditions:
- Relation conditions,
such as:
- Numeric comparisons
- Alphanumeric comparisons
- DBCS comparisons
- National comparisons
- Class
conditions; for example, to test whether a data item:
IS NUMERIC
IS ALPHABETIC
IS ALPHABETIC-LOWER
IS ALPHABETIC-UPPER
IS DBCS
IS KANJI
- Condition-name conditions, to test the value of a conditional variable that you define
- Sign conditions, to test whether
a numeric operand
IS POSITIVE
,NEGATIVE
, orZERO
- Switch-status conditions, to test the status of UPSI switches
that you name in the
SPECIAL-NAMES
paragraph - Complex
conditions, such as:
- Negated conditions; for example,
NOT (A IS EQUAL TO B)
- Combined conditions (conditions
combined with logical operators
AND
orOR
)
- Negated conditions; for example,
related tasks
Defining switches and flags
Resetting switches and flags
Checking for incompatible data (numeric class test)
Comparing national (UTF-16) data
Testing for valid DBCS characters
Defining switches and flags
Resetting switches and flags
Checking for incompatible data (numeric class test)
Comparing national (UTF-16) data
Testing for valid DBCS characters
related references
General relation conditions (Enterprise COBOL for z/OS® Language Reference)
Class condition (Enterprise COBOL for z/OS Language Reference)
Rules for condition-name entries (Enterprise COBOL for z/OS Language Reference)
Sign condition (Enterprise COBOL for z/OS Language Reference)
Combined conditions (Enterprise COBOL for z/OS Language Reference)
General relation conditions (Enterprise COBOL for z/OS® Language Reference)
Class condition (Enterprise COBOL for z/OS Language Reference)
Rules for condition-name entries (Enterprise COBOL for z/OS Language Reference)
Sign condition (Enterprise COBOL for z/OS Language Reference)
Combined conditions (Enterprise COBOL for z/OS Language Reference)