| |
 |
|
| |
COBOL TUTORIAL
FOR BCA STUDENTS OF M G UNIVERSITY |
|
| |
|
|
| |
 |
|
| |
|
|
| |
 |
|
| |
Any
of the simple condition described above can be preceded
by the logical operator NOT. The effect of placing
the operator NOT before a simple condition is to reverse
the value of the condition.
It may be seen that the operator NOT can be used in
two ways. In simple conditions it can be used as a
part of the condition. It can also be used to precede
a simple condition to make it a negated simple condition.
An example of the first use may be DEPOSIT
NOT LESS THAN 500.00, while an example of
the second use is NOT DEPOSIT LESS THAN 500.00.
Of course, in this case, both the conditions mean
the same thing and can be used in either form. What
matters is the role of the operator NOT. In the former
case NOT is part of a relational operator and in the
latter case it is a logical operator. However, NOT
must not precede a simple condition that includes
NOT as a part if it.
|
|
| |
|
|
| |
|
| |
|
| |
 |
|
| |
Two simple conditions can be connected by the logical
operators AND or OR to form a compound condition (also
known as combined condition). When two conditions
are combined by AND, the compound condition becomes
true only when both the constituent conditions are
true. In all other cases the compound condition is
false.
On the other hand, if OR is used to combine two conditions,
the compound condition is true if either or both the
constituent conditions are true. It is false only
when both the conditions are false.
Example:
|
|
| |
|
| |
This compound condition which will be true only when
the value of AMOUNT is in the range 500 to 999(inclusive
of both). This is because both the simple conditions
are true for these values of AMOUNT. For other values
of AMOUNT, only one of them is true.
|
|
| |
|
| |
This compund condition will be false only when the
value of AMOUNT is in the range 500 to 999.
|
|
| |
A
compound condition can consist of any number of simple
or negated simple conditions joined either by AND
or OR.
A compound condition has the following form:
|
|
| |
 |
|
| |
 |
|
| |
Example:
|
|
| |
|
| |
Here, HIGHLY-EDUCATED and HIGHLY-EXPERIENCED are condition
names. If either of them is true and if AGE is less
than 30, 3 will be moved to BONUS-CODE.
|
|
| |
Abbreviation: |
|
| |
Consecutive
relational conditions in a compound condition can
be abbreviated:
1. When the subjects in the consecutive relational
conditions are identical.
|
|
| |
|
|
| |
2. When the subjects and relational operators in the
consecutive relational conditions are Identical.
|
|
| |
|
|
| |
 |
|
| |
|
|
| |
 |
|
| |
|
|