Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 6: Procedure Division


  • The ADD verb is used to calculate the sum of two or more numbers and store the calculated sum
  • Basic syntax:-
    Format 1:-

    ADD  {identifier-1/letral-1}  [, {identifier-1/literal-2}] … TO identifier-3 [,identifier-4]…

    Format 2:-

    ADD {identifier-1/letral-1}, {identifier-2/literal-2} [, {identifier-3/literal-3}] … GIVING identifier-4 [, identifier-5]…

  • Below table will help you understand few possible operations using ADD
  • From the above mentioned possible operations, you will be able to infer that, when using the "TO" option, the previous value of the last identifier (to the right of the "TO") takes place in the summation, and then this value is replaced by the result. This is not the case, when the GIVING option is specified.
  • Last named operand must never be literal as the resultant sum is always stored there.
  • The TO and GIVING options cannot be used simultaneously

© copyright mainframebug.com
Privacy Policy