Example of add verb, COBOL Programming

Example of add verb:

(a) ADD A TO B.

This illustration represents that the value of A will be added to the value of B and the result will be stored in B.  The alignment of the decimal point is completed automatically.

(b) ADD A B C TO D.

In this situation the values of A, B & C will be sum to the older value of D and the resulting sum will be the latest value of D.

(c) ADD 30 A TO B.

This illustration represents that the number 30, the value of A & the value of B will be added and the resulting sum will be stored in B.

(d) ADD A, B GIVING C.

At this point only the values of A & B will be added and the sum will be stored in C. The older value of C will be lost and that value will not take part in the summation.

(e) ADD A, B GIVING C, D, E.

In this situation the value of A, B will be added and sum will be stored in C, D & E. 

Therefore after the execution of this statement, C, D and E will have similar value. The above illustration indicate that in the case of the TO option the earlier value of the last named operand takes part in the summation and then this value is substituted by the result. Though, this is not the situation when the GIVING option is used. It should be mentioned that the last named operand in both the cases can never be a literal as the resultant sum is always stored there.

It is very important to note that TO and GIVING cannot be used concurrently. And hence, ADD A TO B GIVING C would be wrong.  The aim is served by specifying as ADD A B

GIVING C. With the GIVING option identifier-2/numeric- literal-2 is a must.

Posted Date: 10/16/2012 5:18:04 AM | Location : United States







Related Discussions:- Example of add verb, Assignment Help, Ask Question on Example of add verb, Get Answer, Expert's Help, Example of add verb Discussions

Write discussion on Example of add verb
Your posts are moderated
Related Questions
Example of Nested if statement: Illustration: Consider the following sentence The nested IF sentence holds two IFs and one ELSE. The IF-ELSE couple has been marke

/ (Slash Insertion): The edit character slash (/) also termed as virgule or stroke, may appear anyplace in the picture. When used, it will be inserted. More than one slash can

bal majduri ik kanuni apradh hai is de bavjud bache ,ghra,hotla,road, kam karn lai majbur han bacheya te mapeya nu parhai val prerit karn lai ik bashan teyar kro

MERGE VERB WITH OUTPUT PROCEDURE: Like the sort verb, the merge verb can also have an output procedure. The syntax of the MERGE verb is as shown below:   The r

Example of compound condition: In common, a compound condition has the form which is as shown below: Where condition-1 & condition-2 can be any one of the below:

Illustration of nested if statement: Consider the nested sentence which is as shown below: The IF-ELSE pairs in this sentence can be detected by applying the rule whic

Examples - Edit characters for numeric data: The following illustration illustrates the use of Z editing characters. The character b is used to indicate the space character an

BLOCK CONTAINS CLAUSE: Integer -1 of the BLOCK CONTAINS clause indicates the block size either in terms of records or in terms of characters. For illustration, BLOCK CONTAINS

PERFORM STATEMENT:   The PERFORM statement can be used to execute the group of consecutive statements written elsewhere in the program. We refer to this group of statements a

The LENDER Bank offers mortgages on homes valued up to $500,000. The required down payment is calculated as follows: 4% of the first $60,000 borrowed 8% of the next $30,000 borro