       IDENTIFICATION DIVISION.
       PROGRAM-ID.  NUCTST.
      *
       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.
       SOURCE-COMPUTER.  RMCOBOL.
       OBJECT-COMPUTER.  RMCOBOL.
      *
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       77  NUM-1                        PIC 999.
       77  NUM-2                        PIC 999.
       01  GROUP-A.
           03  SUB-A1                   PIC 9.
           03  SUB-A2                   PIC 9.
           03  SUB-A3                   PIC 9.
       01  GROUP-B                                 USAGE COMP-3.
           03  SUB-B1                   PIC S9(2)V99.
           03  SUB-B2                   PIC S9(5)V99.
           03  SUB-B3                   PIC S9(4).
           03  SUB-B4                   PIC 9(4).
       77  CORRECT                      PIC X(4)   VALUE "PASS".
       77  INCORRECT                    PIC X(4)   VALUE "FAIL".
       77  RETURN-KEY                   PIC X.
       77  CALC-VALUE                   PIC 999.
       77  EDITED-VALUE                 PIC 9(9)V9(9).
       77  COUNTER                      PIC 9.
      /
      *
       PROCEDURE DIVISION.
       INIT-PARA.
           MOVE 100 TO NUM-1.
           MOVE 200 TO NUM-2.
           MOVE 005 TO GROUP-A.
           MOVE .00 TO SUB-B1.
           MOVE 42.00 TO SUB-B2.
           MOVE 5.00 TO SUB-B3.
           MOVE 1 TO SUB-B4.
           MOVE ZERO TO COUNTER.
      *
       PARA-1.
           DISPLAY "THIS SECTION TESTS RUNTIME NUCLEUS FUNCTIONS."
               LINE 4 POSITION 16 ERASE.
           DISPLAY "OPERATION" LINE 8 POSITION 2.
           DISPLAY "DISPLAY           CALCULATED           PASS/FAIL"
               LINE 8 POSITION 15.
      *
       TEST-1.
           COMPUTE CALC-VALUE = (SUB-A3 * 60) - NUM-1. 
           DISPLAY "COMPUTE" LINE 10 POSITION 3.
           DISPLAY CALC-VALUE LINE 10 POSITION 36.
           DISPLAY NUM-2 LINE 10 POSITION 17.
           IF CALC-VALUE = NUM-2
               DISPLAY CORRECT LINE 10 POSITION 57
           ELSE DISPLAY INCORRECT LINE 10 POSITION 57
               ADD 1 TO COUNTER.
      *
       TEST-2.
           COMPUTE CALC-VALUE ROUNDED = 
               (NUM-1 / 6) / SUB-A3.
           ADD 2 TO CALC-VALUE.
           DISPLAY "COMPUTE" LINE 11 POSITION 3.
           DISPLAY CALC-VALUE LINE 11 POSITION 36.
           DISPLAY GROUP-A LINE 11 POSITION 17.
           IF CALC-VALUE = GROUP-A
               DISPLAY CORRECT LINE 11 POSITION 57
           ELSE DISPLAY INCORRECT LINE 11 POSITION 57
               ADD 1 TO COUNTER.
      *
       TEST-3.
           DISPLAY "COMP-EDIT" LINE 12 POSITION 2.
           COMPUTE EDITED-VALUE = ((100 - SUB-B1) / 100 *
               SUB-B2 * SUB-B3 / SUB-B4)
               ON SIZE ERROR GO TO ERROR-MESSAGE.
           DISPLAY NUM-1 LINE 12 POSITION 17.
           DISPLAY NUM-1 LINE 12 POSITION 36.
           DISPLAY CORRECT LINE 12 POSITION 57.
      /
      *
       TEST-4.
           MOVE NUM-1 TO CALC-VALUE.
           MULTIPLY SUB-A3 BY NUM-1.
           MOVE NUM-1 TO NUM-2.
           DIVIDE 5 INTO NUM-2.
           MOVE CALC-VALUE TO NUM-1.
           DISPLAY "CALC-MOVE" LINE 13 POSITION 2.
           DISPLAY NUM-1 LINE 13 POSITION 17.
           DISPLAY NUM-2 LINE 13 POSITION 36.
           IF NUM-1 = NUM-2 
               DISPLAY CORRECT LINE 13 POSITION 57
           ELSE DISPLAY INCORRECT LINE 13 POSITION 57
               ADD 1 TO COUNTER.
      *
       TEST-5.
           ADD 11 TO NUM-2.
           MOVE NUM-2 TO GROUP-A.
           ADD SUB-A1, SUB-A2, SUB-A3 TO NUM-1.
           DIVIDE 3 INTO NUM-1 ROUNDED.
           ADD 77 TO NUM-1.
           DISPLAY "CALC-MOVE" LINE 14 POSITION 2.
           DISPLAY NUM-1 LINE 14 POSITION 17.
           DISPLAY NUM-2 LINE 14 POSITION 36.
           IF NUM-1 = NUM-2
               DISPLAY CORRECT LINE 14 POSITION 57
           ELSE DISPLAY INCORRECT LINE 14 POSITION 57
               ADD 1 TO COUNTER.
      *
       TEST-6.
           SUBTRACT SUB-A2 FROM NUM-1.
           COMPUTE CALC-VALUE = (NUM-1 / 10) - SUB-A3.
           DIVIDE 10 INTO NUM-2 ROUNDED.
           SUBTRACT SUB-B4 FROM NUM-2.
           DISPLAY "ROUNDED" LINE 15 POSITION 3.
           DISPLAY NUM-2 LINE 15 POSITION 17.
           DISPLAY CALC-VALUE LINE 15 POSITION 36.
           IF NUM-2 = CALC-VALUE
               DISPLAY CORRECT LINE 15 POSITION 57
           ELSE DISPLAY INCORRECT LINE 15 POSITION 57
               ADD 1 TO COUNTER.
      /
      *
       TEST-7.
           DISPLAY "OVER-FLOW" LINE 16 POSITION 2.
           COMPUTE CALC-VALUE = (101 * (SUB-B4 + 9)) / SUB-B4
               ON SIZE ERROR
                   DISPLAY "OVERFLOW" LINE 16 POSITION 15
                   DISPLAY "OVERFLOW" LINE 16 POSITION 34
                   DISPLAY CORRECT LINE 16 POSITION 57
                   GO TO TEST-8.
           DISPLAY "SHOULD'VE HAD OVERFLOW" LINE 16 POSITION 26.
           DISPLAY INCORRECT LINE 16 POSITION 57.
           ADD 1 TO COUNTER.
      *
       TEST-8.
           MOVE 2 TO CALC-VALUE.
           SUBTRACT 1 FROM NUM-2.
           PERFORM TEST-8-LOOP NUM-2 TIMES.
           MULTIPLY 57 BY NUM-2.
           DISPLAY "PERFORM" LINE 17 POSITION 3.
           DISPLAY NUM-2 LINE 17 POSITION 17.
           DISPLAY CALC-VALUE LINE 17 POSITION 36.
           IF CALC-VALUE = NUM-2
               DISPLAY CORRECT LINE 17 POSITION 57
           ELSE DISPLAY INCORRECT LINE 17 POSITION 57
               ADD 1 TO COUNTER.
      *
       TEST-9.
           COMPUTE CALC-VALUE ROUNDED =
               (NUM-2 - 13) / 450.
           MOVE 001 TO GROUP-A.
           DISPLAY "ROUNDED" LINE 18 POSITION 3.
           DISPLAY GROUP-A LINE 18 POSITION 17.
           DISPLAY CALC-VALUE LINE 18 POSITION 36.
           IF CALC-VALUE = SUB-B4
               DISPLAY CORRECT LINE 18 POSITION 57
           ELSE DISPLAY INCORRECT LINE 18 POSITION 57
               ADD 1 TO COUNTER.
      /
      *
       DISPLAY-RESULTS.
           DISPLAY COUNTER LINE 20 POSITION 40.
           IF COUNTER = 1
               DISPLAY " ERROR ENCOUNTERED" POSITION 0
           ELSE
               DISPLAY " ERRORS ENCOUNTERED" POSITION 0.
       EXIT-PARA.
           EXIT PROGRAM.
       STOP-PARA.
           STOP RUN.
      *
       ERROR-MESSAGE.
           DISPLAY "SIZE ERROR !" LINE 12 POSITION 26.
           DISPLAY INCORRECT LINE 12 POSITION 57.
           ADD 1 TO COUNTER.
           GO TO TEST-4.
      *
       TEST-8-LOOP.
           MULTIPLY 2 BY CALC-VALUE.
           SUBTRACT SUB-A3 FROM CALC-VALUE.
      *
       END PROGRAM.
