Example of add verb, COBOL Programming

Assignment Help:

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.


Related Discussions:- Example of add verb

Kirat da satikar, bal majduri ik kanuni apradh hai is de bavjud bache ,ghra...

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

Occurs, what does it used

what does it used

Indexed tables, INDEXED TABLES: The OCCURS clause that is used to defi...

INDEXED TABLES: The OCCURS clause that is used to define tables can optionally have an INDEXED phrase. This phrase involves the names of data items which are to be used as sub

Cobol program, Write a COBOL IF sentence to use the values of numeric var...

Write a COBOL IF sentence to use the values of numeric variables EXAM and COURSEWORK , both assumed to be with format PIC 999 and in the range 0 to 100 and to move the value:

Comparison of nonnumeric operands - relational condition, Comparison of Non...

Comparison of Nonnumeric Operands: A nonnumeric operand can be compared to the other nonnumeric operand according to the rules as shown below: (i) Fields of Equal Sizes:

Program for subtract verb, PROGRAM FOR SUBTRACT VERB: We have to write...

PROGRAM FOR SUBTRACT VERB: We have to write a simple program to elaborate the SUBTRACT verb. You can also use edit characters in the program. Identification division. Pr

Floating insertion - , Floating Insertion   The currency symbol ($) c...

Floating Insertion   The currency symbol ($) can emerge in multiples on the left-hand side of the picture. In this situation the character will be treated in similar way as t

Block size - file characteristics , Block Size: The normal practice is...

Block Size: The normal practice is to group a number of consecutive records to form that is termed as a block or a physical record. The number of records in a block is frequen

Move verb - cobol programming, Introduction to MOVE Verb: The aim of th...

Introduction to MOVE Verb: The aim of this section is to introduce the learner how to move data from one place to the other place in the memory. This is completed with the help

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd