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
PROGRAM FOR IF :   We have to write a program to check whether the given number is ODD or EVEN. Identification division. Program- id. Ifst. Environment division.

Rules for apply for the condition name: The rules below apply for the condition name. (i) The Condition names should be explained at level 88. The level number starts in ma

OPEN statement: We know that the processing of a file should start with the execution of an OPEN statement. The file can be opened in any one of the 4 open modes - INPUT, OUTP

PROCEDURE DIVISION statements for the indexed files: All the statements which are available for a relative file are also available for an indexed file. READ STTATEMENT :

When using the accept verb in cobol is it possible to assign something other then "SYSIN" for a ddname?

PROGRAM FOR INDEXED SEQUENTIAL FILE CREATION (RANDOM MODE): We have to write a program to create an Indexed Sequential File in random mode for Student particulars. Suppose jus

Picture Clause: The picture clause explains the general characteristics of an elementary data item. These characteristics are elaborated below: Class: In COBOL the

PROGRAM FOR PERFORM ...UNTIL We have to write a program to find the sum of "n" natural numbers. Identification division. Program- id. PerfUntil. Environment division.

CLOSE STATEMENT: When the processing of a file is completed, then the file may be closed. This is completed with the help of the CLOSE-verb. The form of the CLOSE statement is

Figurative Constants: The Figurative constants have several fixed names and the compiler recognizes these names and it sets up the equivalent values in the object program.