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

Module 6: Procedure Division


ARITHMETIC VERBS

  • Most of business logic involves computations to be performed on numeric inputs or intermediate data values to achieve desired results
  • COBOL has provided arithmetic verbs to perform such computations
  • Most important arithmetic verbs are:-
    • ADD verb: The ADD verb is used to calculate the sum of two or more numbers and store the calculated sum. For more details about ADD verb, click here < LINK >
    • SUBTRACT verb: The SUBTRACT verb is used to subtract one or the addition of two or more numeric values from one or more numeric values and store the subtracted value. For more details about SUBTRACT verb, click here < LINK >
    • MULTIPLY verb: MULTIPLY verb is used to multiply two or more numeric values and store the final result. For more details about MULTIPLY verb, click here < LINK >
    • DIVIDE verb: DIVIDE verb is used to divide one numeric value by another numeric value and store the calculated value. For more details about DIVIDE verb, click here < LINK >
  • Options available with arithmetic verbs are:-
    • ROUNDED option: ROUNDED option can be used with ADD, SUBTRACT, DIVIDE and MULTIPLY verbs. ROUNDED option is used to round off the value as per PICTURE clause specification of the receiving field. For more details about ROUNDED option, click here < LINK >
    • ON SIZE ERROR option: SIZE ERROR occurs in arithmetic operation when result value exceeds the size of the PICTURE specification of receiving field. Such size errors can be handled using ON SIZE ERROR option. For more details about ON SIZE ERROR option, click here < LINK >
    • CORRESPONDING option (Only with ADD & SUBTRACT): CORRESPONDING can only be used with ADD and SUBTRACT arithmatics verbs. It is used to perform ADD and SUBTRACT on corresponding matching elementary items belonging to group items






© copyright mainframebug.com
Privacy Policy