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

Subtract verb, SUBTRACT VERB: The SUBTRACT verb is used to subtract on...

SUBTRACT VERB: The SUBTRACT 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

Blank when zero - edit characters for numeric data, BLANK WHEN ZERO: ...

BLANK WHEN ZERO: BLANK WHEN ZERO is an editing clause that may be used along with a picture. This will set the whole data item to blanks of its value is equal to zero. Though,

File volatility and file interrogation, File volatility: File volatili...

File volatility: File volatility associates to the number of times the updating of records are needed during some time period. File interrogation: Some files hold re

Subscript and index, What is the difference between subscript and index

What is the difference between subscript and index

Label record and value of clause, LABEL RECORD CLAUSE: This clause spe...

LABEL RECORD CLAUSE: This clause specifies whether or not the standard header and trailer labels must be present in the magnetic-tape files. VALUE OF CLAUSE: The VAL

#Array, Major difference between file and array how does record read from a...

Major difference between file and array how does record read from array and file why we are not preparing array for real time

Program for screen section with files, PROGRAM FOR SCREEN SECTION WITH FILE...

PROGRAM FOR SCREEN SECTION WITH FILES: identification division.   program- id.   environment division.          input-output section.   file-control.     select

Comparison of the numeric operand with nonnumeric operand, Comparison of th...

Comparison of the Numeric Operand with Nonnumeric Operand: The numeric operand can be compared to the nonnumeric operand subject to the restrictions which are as follows.

Redefine clause, Can we declare a redefine clause as below? A Redefines B, ...

Can we declare a redefine clause as below? A Redefines B, PIC X(4)

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

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