CIS133C CLASS 9

  • ADD


  • ADD ADDEND TO AUGEND

    Where addend is one or more identifier (data-name of a numeric field) or a numeric literal and augend is one or more identifiers but never a numeric literal. The result is stored in the data fields(s) listed last (augend). All other data fields remain unchanged.

    ADD +1 TO WS-COUNTER
    ADD WS-NBR1 TO WS-NBR2
    ADD WS-NBR3 +25 TO WS-NBR4
    ADD WS-NBR5 WS-NBR6 TO WS-NBR7 WS-NBR8

  • ADD with the GIVING clause


  • ADD FIELD1 FIELD2 GIVING FIELD3.
    ADD AMT1 TO AMT2 GIVING AMT3 AMT4.

  • SUBTRACT

    SUBTRACT SUBTRAHEND FROM MINUEND

    Where subtrahend is one or more identifiers or literals and is subtracted from the minuend which is one or more identifiers but not a literal. The resulting difference is stored in the minuend(s). The value(s) of the subtrahend is/are not changed.

    SUBTRACT 25.69 FROM WS-NBR1
    SUBTRACT WS-NBR2 WS-NBR3 13.95 FROM WS-NBR4
    SUBTRACT WS-NBR5 FROM WS-NBR6 WS-NBR7

  • SUBTRACT using the GIVING clause

  • MULTIPLY

    MULTIPLY FACTOR BY PRODUCT(S)

    Multiply only one identifier or literal by one or more identifiers. The contents of the factor is unchanged but the value of the product(s) is/are changed.

    MULTIPLY 1.018 BY CURR-HOURLY-RATE
    MULTIPLY WS-NBR1 BY WS-NBR2 WS-NBR3 WS-NBR4

    To perform the arithmetic statement A*B*C you must use two multiply statements . . .
    MULTIPLY FIELD-A BY FIELD-B
    MULTIPLY FIELD-B BY FIELD-C
    And the values of FIELD-B and FIELD-C are now changed but FIELD-C contains the results of multiplying A times B times C.

  • MULTIPLY using the GIVING clause

  • DIVIDE/INTO

  • DIVIDE/INTO with the GIVING clause

  • DIVIDE/BY

  • DIVIDE/BY with the GIVING clause

  • ROUNDED CLAUSE

  • REMAINDER CLAUSE

  • ON SIZE ERROR CLAUSE

  • COMPUTE

  • ORDER OF MATHEMATICAL OPERATIONS:

    1. EXPONENTIATION **
    2. MULTIPLY * AND/OR DIVIDE / LEFT TO RIGHT
    3. ADD + AND/OR SUBTRACT - LEFT TO RIGHT
    4. WITH PARENTHESIS () TAKING PRECEDENCE



TO
COBOL
BOOKS
PAGE
TO
COBOL
LINKS
PAGE
TO
CLASS ASSIGNMENTS
AND HANDOUTS
PAGE
TO
COBOL
NOTES
PAGE
TO
HOME
PAGE
EMAIL
ME AT
HOME
EMAIL
ME AT
WORK


Background gif from . . .
1