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

Value clause - cobol programming, VALUE CLAUSE: The value clause defin...

VALUE CLAUSE: The value clause defines the preliminary value of the data item. Normally initialization will be completed just before the first statement in the procedure di

Close statement, CLOSE STATEMENT: When the processing of a file is com...

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

Data names and identifiers - cobol program, Data Names and Identifiers:   ...

Data Names and Identifiers:   The Data name provides reference to the storage space in the memory where the real value is stored. This value takes part in the operation whene

Blank insertion and zero insertion, B (Blank Insertion) : The occurren...

B (Blank Insertion) : The occurrence of a B anyplace in the picture will insert a space character in the edited data. There can be more than one B in the picture. Examples:

Program to demonstrate sort verb, PROGRAM TO DEMONSTRATE SORT VERB: Th...

PROGRAM TO DEMONSTRATE SORT VERB: The file for which a record having 2 fields, viz., Account Number and Name is already available. Sort the file based on the ascending order o

Different data types available in cobol, Data types available in COBOL are ...

Data types available in COBOL are given below Alpha-numeric (X), numeric (9), alphabetic (A)

Picture specification - picture clause, PICTURE specification: The siz...

PICTURE specification: The size of a group item is equivalent to the total of the sizes of all the subordinate elementary items. The group item class is alphanumeric. The i

Simple sort verb, THE SIMPLE SORT VERB: The process of sequencing the ...

THE SIMPLE SORT VERB: The process of sequencing the records in some preferred manner is termed as sorting. The Sorting is done upon some key data item in the record. For illus

Blank insertion and zero insertion, B (Blank Insertion) : The occurren...

B (Blank Insertion) : The occurrence of a B anyplace in the picture will insert a space character in the edited data. There can be more than one B in the picture. Examples:

Example of compound condition, Example of compound condition: In commo...

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:

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