home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / cobol / compiler / cobol650 / cobsrc / prog416.cob < prev    next >
Text File  |  1990-09-02  |  2KB  |  60 lines

  1.        IDENTIFICATION DIVISION.
  2.       *
  3.        PROGRAM-ID. PROG416.
  4.       *
  5.       *********************************************************
  6.       *                                                       *
  7.       * 1. DATE-WRITTEN. 08/01/90.                            *
  8.       *                                                       *
  9.       * 2. THIS PROGRAM DISPLAYS ON THE PRINTER               *
  10.       *    A VALUE COMPUTED FROM A DIVIDE   OPERATION.        *
  11.       *                                                       *
  12.       * 3. THE QUOTIENT IS PLACED INTO A DIFFERENT FIELD      *
  13.       *                                                       *
  14.       * 4. THE DIVIDE OPERATION AND DISPLAY WILL BE DONE TWICE*
  15.       *    A) TRY #1 - QUOTIENT IS NOT ROUNDED OFF.           *
  16.       *    B) TRY #2 - QUOTIENT IS ROUNDED OFF.               *
  17.       *                                                       *
  18.       *********************************************************
  19.       *
  20.       *
  21.        ENVIRONMENT DIVISION.
  22.       *
  23.        CONFIGURATION SECTION.
  24.       *
  25.        SPECIAL-NAMES.
  26.       *
  27.            PRINTER IS PRINTER-DISPLAY.
  28.       *
  29.       *
  30.        DATA DIVISION.
  31.       *
  32.       *
  33.       ****************************************************
  34.       *                                                  *
  35.        WORKING-STORAGE SECTION.
  36.       *                                                  *
  37.       ****************************************************
  38.       *
  39.       *
  40.        01  W005-DIVISOR                    PIC 9   VALUE 3.  
  41.       *
  42.        01  W005-DIVIDEND                   PIC 9   VALUE 5.
  43.       *
  44.        01  W005-QUOTIENT                   PIC 9.
  45.       *
  46.       *
  47.        PROCEDURE DIVISION.
  48.       *
  49.        PRINT-COMPUTED-VALUE.
  50.            DIVIDE W005-DIVISOR INTO W005-DIVIDEND GIVING W005-QUOTIENT.
  51.            DISPLAY "PROGRAM PROG414: THE QUOTIENT OF 5 / 3 UNROUNDED IS
  52.       -        ":"                   UPON PRINTER-DISPLAY.
  53.            DISPLAY W005-QUOTIENT     UPON PRINTER-DISPLAY.
  54.            DIVIDE W005-DIVISOR INTO W005-DIVIDEND 
  55.                                     GIVING W005-QUOTIENT ROUNDED.
  56.            DISPLAY "PROGRAM PROG414: THE QUOTIENT OF 5 / 3 ROUNDED IS:"
  57.                                      UPON PRINTER-DISPLAY.
  58.            DISPLAY W005-QUOTIENT     UPON PRINTER-DISPLAY.
  59.            STOP RUN.
  60.