| |
 |
|
| |
COBOL TUTORIAL
FOR BCA STUDENTS OF M G UNIVERSITY |
|
| |
|
|
| |
 |
|
| |
|
| |
|
| |
This verb is used to subtract one, or the sum of two
or more numbers from one or more numbers and to store
the result.
The form of the SUBTRACT verb is as follows:
|
|
| |
|
|
| |
Examples:
|
|
| |
|
|
| |
This statement means that the value of A will be subtracted
from the value of B and the subtracted result will
be stored in B. The decimal point alignment will be
done automatically.
|
|
| |
|
|
| |
This one shows that the value of B and A will be added
and the resultant sum will be subtracted from the
value of C. After subtraction, the final result will
be stored in C. The old value of C will be lost.
|
|
| |
|
|
| |
This indicates that the summation of the value of
A and B will be subtracted from the value of C and
the final result will be stored in D. The old value
of D will be lost whereas in this case C retains the
old value.
|
|
| |
|
| |
Here the number 15 will be subtracted from the values
of A and B. A and B will receive these new values.
|
|
| |
As in the case of the ADD statement, here also the
last-named operand must not be a literal as the final
result will be stored there. If the GIVING option
is used, identifier-3, identifier-4 etc. can also
be numeric literals.
For example:
SUBTRACT A B FROM 50 GIVING C.
|
|
| |
|
| |
|
|
| |
 |
|
| |
|
|
| |
 |
|
| |
|
|