COBOL Manual for TNS and TNS/R Programs

Procedure Division
HP COBOL Manual for TNS and TNS/R Programs522555-006
8-53
Conditional Expressions
When a conditional expression compares two expressions, the compiler determines
the smallest number of decimal places suitable for each of the expressions and then
uses the larger of those numbers of decimal places.
In a COMPUTE statement, the number of decimal places of the composite of operands
of the receiving fields is the number of decimal places of the expression.
If ROUNDED is specified on any operand, one additional decimal position is used in
the computation, then the rounding is applied to the result.
Conditional Expressions
Many different statements include conditional expressions. A conditional expression is
a syntactically correct combination of simple conditions, logical operators, and
parentheses that can be evaluated to a truth value. The truth value determines which
of two paths of control the object program takes.
The simplest form of a conditional expression is a simple condition. Complex
conditions are combinations of simple conditions and any of the logical operators NOT,
AND, and OR. COBOL allows you to abbreviate sequences of complex relation
conditions. You can use balanced sets of parentheses to control or clarify the order of
evaluation within a conditional expression.
Topics:
Simple Conditions
Complex Conditions
Abbreviated Combined Relation Conditions
Condition Evaluation Rules
Simple Conditions
A simple condition has a truth value of TRUE or FALSE. Enclosing a simple condition
within parentheses does not affect its truth value. The simple conditions are:
Relation Conditions in General
Relation Conditions With Nonpointer Operands
Relation Conditions With Pointer Operands
Class Conditions
Condition-Name Conditions (Conditional Variables)
Switch-Status Conditions
Sign Conditions