Mainframes 360 The one stop destination for System Z
professionals  Saturday, September 26, 2009  Arithmetic
operators  Q. What are the Arithmetic Operators in Cobol? Cobol
has five standard arithmetic verbs, ADD, SUBTRACT, MULTIPLY,
DIVIDE and COMPUTE. Arithmetic statements can be written in
various different forms. Look at the examples below.  The ADD
verb adds up the first number TO the second. If you write ADD X
TO Y, it means Y + X. If you write ADD X Y TO Z, it means (i)
first add X to Z (ii)second add Y to Z. The result of addition
is always stored in the second. If an optional GIVING keyword is
specified on the ADD statement, the result of the addition is
assigned to a third variable.  The SUBTRACT verb subtracts the
first number FROM the second. If you write SUBTRACT Y FROM X, it
means X – Y. If you write SUBTRACT X Y FROM W, it means (i)
first subtract X from W (ii)second subtract Y from W. The
difference is stored in the second.  The MULTIPLY verb computes
the product of the first times the second.