CICS subprogram not running properly

Tags:
CICS
CICS Subprogram Performance
CICS Subprograms
Why isn't this subprogram running properly?
Main-Program:

ENVIRONMENT DIVISION.

INPUT-OUTPUT SECTION.

FILE-CONTROL.

    SELECT TEST-RESULTS-FILE

        ASSIGN TO DISK "TESTRESULTS.TXT"

        ORGANIZATION IS LINE SEQUENTIAL.

 

    SELECT PRINT-FILE

        ASSIGN TO PRINTER "TEST-RESULTS-REPORT.TXT".

 

DATA DIVISION.

FILE SECTION.

 

FD TEST-RESULTS-FILE.

01 TEST-RESULTS-RECORD                  PIC X(67).

FD PRINT-FILE.

01 PRINT-REC                            PIC X(80).

 

WORKING-STORAGE SECTION.

01 SWITCHES-AND-COUNTERS.

    05 NUMBER-OF-ERRORS-IN-THIS-RECORD  PIC S9(04) COMP VALUE 0.

 

    05 EOF-TEST-RESULTS-FILE-SWITCH     PIC X   VALUE 'F'.

        88 EOF-DETECTED                         VALUE 'T'.

    05 SAVE-ERROR                       PIC X(35).

 

01 WS-TEST-RESULTS-RECORD.

    05 STUDENT-NAME                     PIC X(21).

        88 STUDENT-NAME-BLANK               VALUE SPACES.

    05 FIRST-LETTER-STUDENT-NAME   REDEFINES STUDENT-NAME.

       10 FIRST-LETTER                  PIC X.

           88 STUDENT-NAME-NOT-LEFT-JUSTIFIED VALUE SPACES.

       10 REST-OF-NAME                  PIC X(20).

    05 FILLER                           PIC X(03).

    05 ITEMS-CORRECT                    PIC 9(03).

    05 X-ITEMS-CORRECT REDEFINES ITEMS-CORRECT

                                        PIC X(03).

    05 FILLER                           PIC X.

    05 ITEMS-WRONG                      PIC 9(03).

    05 X-ITEMS-WRONG REDEFINES ITEMS-WRONG

                                        PIC X(03).

    05 FEE-TAKING-TEST                  PIC 9(03)V9.

        88 FEE-RANGE                       VALUE 0 THRU 125.00.

 

    05 TEST-FEE REDEFINES FEE-TAKING-TEST

                                        PIC X(5).

        88 FEE-BLANK                       VALUE SPACES.

 

    05 UNUSED-AREA                      PIC X(21).

        88 CHECKING-UNUSED-SPACE           VALUE SPACES.

 

    05 FEE-PAID                         PIC X.

       88 FEE-PAID-BLANK                   VALUE SPACES.

       88 VALID-RESPONSE                   VALUE 'N','n','Y','y'.

 

 

    05 SCORE-EXAM                       PIC 9(03)V9.

       88 SCORE-EXAM-RANGE                 VALUE 0 THRU 100.

       88 SCORE-EXAM-REASONABLE            VALUE 80 THRU 100.

    05 EXAM-SCORE REDEFINES SCORE-EXAM

                                        PIC X(04).

       88 SCORE-EXAM-BLANK                 VALUE SPACES.

    05 MAJOR-CODE                       PIC X(04).

 

                                       01 WS-DATE.

   05 WS-YEAR                           PIC X(02).

   05 WS-MONTH                          PIC X(02).

   05 WS-DAY                            PIC X(02).

 

01 WS-INDEPENDENT-DATA-ITEMS.

   05 WS-PAGE-COUNTER                   PIC S9(04).

   05 ERROR-COUNT                       PIC 9 VALUE 0.

        88 NO-ERROR                        VALUE 0.

        88 FIRST-ERROR                     VALUE 1.

   05 GOOD-RECORD-PLACE                 PIC 9(02).

   05 BAD-RECORD-PLACE                  PIC 9(02).

   05 PLACE-TO-SAVE-MSG                 PIC X(30).

 

 

 

01 HDR1.

   05 FILLER                           PIC X(27) VALUE SPACES.

   05 FILLER                           PIC X(06) VALUE " TEXAS ".

   05 FILLER                           PIC X(04) VALUE "A&M ".

   05 FILLER                           PIC X(06) VALUE "CORPUS".

   05 FILLER                           PIC X VALUE SPACE.

   05 FILLER                           PIC X(07) VALUE "CHRISTI".

   05 FILLER                           PIC X(20) VALUE SPACES.

   05 FILLER                           PIC X(05) VALUE "Page ".

   05 HDR-PAGE                         PIC Z(03).

<*** HEADER TO DESCRIBE WHAT IT IS YOU ARE WORKING WITH ***>

01 HDR2.

   05 FILLER                           PIC X(32) VALUE SPACES.

   05 FILLER                           PIC X(07) VALUE "STUDENT".

   05 FILLER                           PIC X(07) VALUE " RECORD".

   05 FILLER                           PIC X(34) VALUE SPACES.

<*** HEADER FOR THE DATE ***>

01 HDR3.

   05 FILLER                           PIC X(36) VALUE SPACES.

   05 HDR3-DATE.

      10 HDR3-MONTH                    PIC X(02).

      10 FILLER                        PIC X VALUE "/".

      10 HDR3-DAY                      PIC X(02).

      10 FILLER                        PIC X VALUE "/".

      10 HDR3-YEAR                     PIC X(02).

      10 FILLER                        PIC X(36) VALUE SPACES.

 

01 HDR4.

   05 FILLER                           PIC X(08) VALUE

                                                    "Students".

   05 FILLER                           PIC X(15) VALUE SPACES.

   05 FILLER                           PIC X(04) VALUE "Test".

   05 FILLER                           PIC X(04) VALUE SPACES.

   05 FILLER                           PIC X(07) VALUE "Fee    ".

   05 FILLER                           PIC X(04) VALUE "Exam".

   05 FILLER                           PIC X(03) VALUE SPACES.

   05 FILLER                           PIC X(05) VALUE "***  ".

   05 FILLER                           PIC X(06) VALUE "Error ".

   05 FILLER                           PIC X(08) VALUE

                                                      "Messages".

   05 FILLER                           PIC X(05) VALUE "  ***".

   05 FILLER                           PIC X(11) VALUE SPACES.

 

01 HDR5.

   05 FILLER                           PIC X(09) VALUE

                                                     "FULL NAME".

   05 FILLER                           PIC X(03) VALUE SPACES.

   05 FILLER                           PIC X(13)

                              VALUE "      CORRECT".

   05 FILLER                           PIC X VALUE SPACES.

   05 FILLER                           PIC X(13)

                                        VALUE "      WRONG".

   05 FILLER                           PIC X VALUE SPACES.

   05 FILLER                           PIC X(03) VALUE "FEE".

   05 FILLER                           PIC X(05) VALUE SPACES.

   05 FILLER                           PIC X(07) VALUE "PAID   ".

   05 FILLER                           PIC X(05) VALUE "SCORE".

   05 FILLER                           PIC X(09) VALUE SPACES.

   05 FILLER                           PIC X(09) VALUE

                                                     "ENCOUNTER".

   05 FILLER                           PIC X(19) VALUE SPACES.

 

01 HDR6.

   05 FILLER                           PIC X(21) VALUE

                                         "=====================".

   05 FILLER                           PIC X(02) VALUE SPACES.

   05 FILLER                           PIC X(07) VALUE "=======".

   05 FILLER                           PIC X(01) VALUE SPACES.

   05 FILLER                           PIC X(04) VALUE "====".

   05 FILLER                           PIC X(03) VALUE SPACES.

   05 FILLER                           PIC X(05) VALUE "=====".

   05 FILLER                           PIC X(02) VALUE SPACES.

   05 FILLER                           PIC X(30) VALUE

                           "=============================".

 

 

01 OUTPUT-REC.

      10 PRT-STUDENT-NAME               PIC X(21).

      10 FILLER                         PIC X(02) VALUE SPACES.

      10 PRT-ITEMS-CORRECT              PIC X(03).

      10 FILLER                         PIC X VALUE SPACES.

      10 PRT-ITEMS-WRONG                PIC X(03).

      10 FILLER                         PIC X VALUE SPACES.

      10 PRT-FEE-TEST                   PIC $Z(03).99.

      10 PRT-FEE REDEFINES PRT-FEE-TEST

                                        PIC X(07).

      10 FILLER                         PIC X(02) VALUE SPACES.

      10 PRT-FEE-PAID                   PIC X.

      10 FILLER                         PIC X(05) VALUE SPACES.

      10 PRT-SCORE-EXAM                 PIC ZZ9.9.

      10 BAD-SCORE-EXAM REDEFINES PRT-SCORE-EXAM PIC X(05).

      10 FILLER                         PIC X(02) VALUE SPACES.

      10 PRT-ERROR-MESSAGE              PIC X(35).

      10 PRT-MAJOR-STUFF REDEFINES PRT-ERROR-MESSAGE.

            15 PRT-MAJOR                      PIC X(5).

            15 PRT-MAJOR-ENTIRE               PIC X(30).

 

01 GOOD-TABLE.

   05 GOOD-RECORD-COUNT   PIC 9(02).

   05 GOOD-RECORD-TABLE OCCURS 35 TIMES.

        10 GOOD-NAME                PIC X(21).

        10 GOOD-CORRECT             PIC X(03).

        10 GOOD-WRONG               PIC X(03).

        10 GOOD-FEE-TAKING-TEST     PIC 9(3)V99.

        10 GOOD-FEE-PAID            PIC X.

        10 GOOD-SCORE               PIC 9(03)V9.

        10 GOOD-MAJOR               PIC X(4).

        10 GOOD-MAJOR-NAME          PIC X(30).

 

01 BAD-TABLE.

   05 WHAT-BAD-ERROR               PIC 9.

   05 BAD-RECORD-COUNT             PIC 9(02) VALUE 0.

   05 BAD-RECORD-TABLE OCCURS 35 TIMES.

        10 BAD-NAME                PIC X(21).

        10 BAD-CORRECT             PIC X(03).

        10 BAD-WRONG               PIC X(03).

        10 BAD-FEE-TAKING-TEST     PIC X(7).

        10 BAD-FEE-PAID            PIC X.

        10 BAD-SCORE               PIC X(4).

        10 BAD-MAJOR               PIC X(4).

        10 BAD-NUM-MSG             PIC 9(2).

        10 BAD-ERROR-MSG        OCCURS 5 TIMES

                                PIC X(35).

 

PROCEDURE DIVISION.

0000-MAIN.

   PERFORM 1000-GET-READY

   PERFORM 1150-READ-RECORDS

   PERFORM 3000-PRINT-VALID-RECORD

     VARYING GOOD-RECORD-PLACE FROM 1 BY 1

     UNTIL GOOD-RECORD-PLACE > GOOD-RECORD-COUNT.

   MOVE SPACES TO OUTPUT-REC

   WRITE PRINT-REC FROM OUTPUT-REC AFTER 3

   PERFORM 3020-PRINT-INVALID-RECORDS

     VARYING BAD-RECORD-PLACE FROM 1 BY 1

     UNTIL BAD-RECORD-PLACE > BAD-RECORD-COUNT.

   MOVE SPACES TO OUTPUT-REC

   WRITE PRINT-REC FROM OUTPUT-REC AFTER 3

   PERFORM 3070-FIND-GRADE

   PERFORM 3080-SORT

   PERFORM 3090-MAJOR-FIND

   PERFORM 4000-CLOSE-FILES

   STOP RUN

   .

1000-GET-READY.

   PERFORM 1110-INITIALIZE

   PERFORM 1120-PRINT-HEADINGS

 

   .

1110-INITIALIZE.

    DISPLAY "HELLO"

    OPEN INPUT TEST-RESULTS-FILE

         OUTPUT PRINT-FILE

    MOVE ZERO TO WS-PAGE-COUNTER

    ACCEPT WS-DATE FROM DATE.

    MOVE WS-MONTH TO HDR3-MONTH

    MOVE WS-DAY   TO HDR3-DAY

    MOVE WS-YEAR  TO HDR3-YEAR

    MOVE 0 TO GOOD-RECORD-COUNT

    .

 

1120-PRINT-HEADINGS.

     ADD 1 TO WS-PAGE-COUNTER

     MOVE WS-PAGE-COUNTER TO HDR-PAGE

     WRITE PRINT-REC FROM HDR1 AFTER ADVANCING 1 LINE

     WRITE PRINT-REC FROM HDR2 AFTER ADVANCING 1 LINE

     WRITE PRINT-REC FROM HDR3 AFTER ADVANCING 1 LINE

     WRITE PRINT-REC FROM HDR4 AFTER ADVANCING 2 LINES

     WRITE PRINT-REC FROM HDR5 AFTER ADVANCING 1 LINE

     WRITE PRINT-REC FROM HDR6 AFTER ADVANCING 1 LINE

     .

 

1150-READ-RECORDS.

    READ TEST-RESULTS-FILE INTO WS-TEST-RESULTS-RECORD

            AT END MOVE 'T' TO EOF-TEST-RESULTS-FILE-SWITCH

            NOT AT END PERFORM 2000-VALIDATE-FIELDS

    END-READ

    .

 

1160-LOAD-GOOD-RECORDS.

     ADD 1 TO GOOD-RECORD-COUNT

     MOVE STUDENT-NAME TO GOOD-NAME(GOOD-RECORD-COUNT).

     MOVE FEE-PAID TO GOOD-FEE-PAID(GOOD-RECORD-COUNT).

     DISPLAY 'GD: '

     MOVE ITEMS-CORRECT TO GOOD-CORRECT(GOOD-RECORD-COUNT).

     DISPLAY 'GD: '

     MOVE ITEMS-WRONG TO GOOD-WRONG(GOOD-RECORD-COUNT).

*TEST FEE IS THE PIC X VALUE NOT THE NUMBERIC VALUE

     MOVE FEE-TAKING-TEST

        TO GOOD-FEE-TAKING-TEST(GOOD-RECORD-COUNT).

     MOVE SCORE-EXAM TO GOOD-SCORE(GOOD-RECORD-COUNT).

     MOVE MAJOR-CODE TO GOOD-MAJOR(GOOD-RECORD-COUNT).

     DISPLAY GOOD-MAJOR(GOOD-RECORD-COUNT).

     DISPLAY GOOD-RECORD-TABLE(GOOD-RECORD-COUNT).

 

     .

 

 

2000-VALIDATE-FIELDS.

    MOVE 0 TO ERROR-COUNT

    PERFORM 2010-CHECK-NAME-FIELD

    PERFORM 2020-CHECK-FEE-FIELD

    PERFORM 2030-CHECK-UNUSED-AREA

    PERFORM 2040-CHECK-FEE-PAID

    PERFORM 2050-CHECK-EXAM-SCORE

    IF NO-ERROR

       PERFORM 1160-LOAD-GOOD-RECORDS

      ELSE

       MOVE WHAT-BAD-ERROR TO BAD-NUM-MSG(BAD-RECORD-COUNT)

    END-IF

    PERFORM 1150-READ-RECORDS

    .

 

2010-CHECK-NAME-FIELD.

  IF STUDENT-NAME-BLANK

     ADD 1 TO ERROR-COUNT

     MOVE "STUDENT NAME IS MISSING" TO PLACE-TO-SAVE-MSG

     PERFORM 2090-ERROR-RTN

  ELSE

    IF STUDENT-NAME-NOT-LEFT-JUSTIFIED

        ADD 1 TO ERROR-COUNT

        MOVE "NAME NO LEFT-JUSTIFIED" TO PLACE-TO-SAVE-MSG

         PERFORM 2090-ERROR-RTN

    END-IF

  END-IF

 .

 

2020-CHECK-FEE-FIELD.

    IF  FEE-BLANK

        ADD 1 TO ERROR-COUNT

        MOVE "FEE IS MISSING" TO PLACE-TO-SAVE-MSG

        PERFORM 2090-ERROR-RTN

    ELSE

        IF TEST-FEE NOT NUMERIC

            ADD 1 TO ERROR-COUNT

            MOVE "TEST FEE IS NOT NUMERIC"

                                      TO PLACE-TO-SAVE-MSG

            PERFORM 2090-ERROR-RTN

        ELSE

           IF NOT FEE-RANGE

            ADD 1 TO ERROR-COUNT

            MOVE "FEE IS OUT OF RANGE" TO PLACE-TO-SAVE-MSG

            PERFORM 2090-ERROR-RTN

           END-IF

       END-IF

    END-IF

    .

 

2030-CHECK-UNUSED-AREA.

    IF NOT CHECKING-UNUSED-SPACE

       ADD 1 TO ERROR-COUNT

       MOVE "MISSING THE SPACE" TO PLACE-TO-SAVE-MSG

       PERFORM 2090-ERROR-RTN

    END-IF

    .

 

2040-CHECK-FEE-PAID.

  IF FEE-BLANK

     ADD 1 TO ERROR-COUNT

     MOVE "NO FEE GIVEN" TO PLACE-TO-SAVE-MSG

     PERFORM 2090-ERROR-RTN

  ELSE

     IF NOT VALID-RESPONSE

      ADD 1 TO ERROR-COUNT

      MOVE "ENTER Y OR N" TO PLACE-TO-SAVE-MSG

       PERFORM 2090-ERROR-RTN

     END-IF

  END-IF

  .

 

2050-CHECK-EXAM-SCORE.

    IF SCORE-EXAM-BLANK

        ADD 1 TO ERROR-COUNT

        MOVE "THE EXAM SCORE IS BLANK." TO PLACE-TO-SAVE-MSG

        PERFORM 2090-ERROR-RTN

    ELSE

        IF EXAM-SCORE NOT NUMERIC

            ADD 1 TO ERROR-COUNT

            MOVE "EXAM SCORE IS NOT NUMERIC."

                                      TO PLACE-TO-SAVE-MSG

             PERFORM 2090-ERROR-RTN

        ELSE

            IF NOT SCORE-EXAM-RANGE

              ADD 1 TO ERROR-COUNT

              MOVE "EXAM SCORE NOT 0 TO 100."

                                      TO PLACE-TO-SAVE-MSG

              PERFORM 2090-ERROR-RTN

            ELSE

              IF NOT SCORE-EXAM-REASONABLE

                ADD 1 TO ERROR-COUNT

                MOVE "A GRAD NOT 80-100."

                                      TO PLACE-TO-SAVE-MSG

                 PERFORM 2090-ERROR-RTN

              END-IF

            END-IF

        END-IF

    END-IF

    .

 

ORIGINAL2090-ERROR-RTN.

          ADD 1 TO NUMBER-OF-ERRORS-IN-THIS-RECORD

          DISPLAY NUMBER-OF-ERRORS-IN-THIS-RECORD

            IF FIRST-ERROR

                PERFORM 2095-PRINT-REC-AND-FIRST-ERROR

            ELSE

                PERFORM 2099-PRINT-MESSAGE-ONLY

            END-IF

        .

 

 

2090-ERROR-RTN.

  ADD 1 TO NUMBER-OF-ERRORS-IN-THIS-RECORD

  IF FIRST-ERROR

    ADD 1 TO BAD-RECORD-COUNT

    PERFORM 2092-FIRST-ERROR-FOUND

  ELSE

       PERFORM 2094-NEXT-ERRORS

        ADD 1 TO BAD-RECORD-COUNT

        PERFORM 2099-PRINT-MESSAGE-ONLY

    END-IF

    .

2092-FIRST-ERROR-FOUND.

    ADD 1 TO BAD-RECORD-COUNT

    MOVE STUDENT-NAME TO BAD-NAME(BAD-RECORD-COUNT)

    MOVE FEE-PAID TO BAD-FEE-PAID(BAD-RECORD-COUNT)

    MOVE ITEMS-CORRECT TO BAD-CORRECT(BAD-RECORD-COUNT)

    MOVE ITEMS-WRONG TO BAD-WRONG(BAD-RECORD-COUNT)

    MOVE TEST-FEE TO BAD-FEE-TAKING-TEST(BAD-RECORD-COUNT)

    MOVE EXAM-SCORE TO BAD-SCORE(BAD-RECORD-COUNT)

    MOVE MAJOR-CODE TO BAD-MAJOR(BAD-RECORD-COUNT)

    MOVE 1 TO WHAT-BAD-ERROR

    MOVE PLACE-TO-SAVE-MSG

      TO BAD-ERROR-MSG(BAD-RECORD-COUNT, WHAT-BAD-ERROR)

    .

 

2094-NEXT-ERRORS.

    ADD 1 TO WHAT-BAD-ERROR.

    MOVE PLACE-TO-SAVE-MSG

      TO BAD-ERROR-MSG(BAD-RECORD-COUNT, WHAT-BAD-ERROR)

   .

 

 

 

3000-PRINT-VALID-RECORD.

  MOVE GOOD-NAME(GOOD-RECORD-PLACE) TO PRT-STUDENT-NAME

  MOVE GOOD-FEE-PAID(GOOD-RECORD-PLACE) TO PRT-FEE-PAID

  MOVE GOOD-FEE-TAKING-TEST(GOOD-RECORD-PLACE) TO PRT-FEE-TEST

  MOVE GOOD-SCORE(GOOD-RECORD-PLACE) TO PRT-SCORE-EXAM

  MOVE GOOD-CORRECT(GOOD-RECORD-PLACE) TO PRT-ITEMS-CORRECT

  MOVE GOOD-WRONG(GOOD-RECORD-PLACE) TO PRT-ITEMS-WRONG

  MOVE GOOD-MAJOR(GOOD-RECORD-PLACE) TO PRT-MAJOR

  MOVE GOOD-MAJOR-NAME(GOOD-RECORD-PLACE) TO PRT-MAJOR-ENTIRE

  WRITE PRINT-REC FROM OUTPUT-REC

       AFTER ADVANCING 2 LINES

  .

 

3020-PRINT-INVALID-RECORDS.

  MOVE BAD-NAME(BAD-RECORD-PLACE) TO PRT-STUDENT-NAME

  MOVE BAD-FEE-PAID(BAD-RECORD-PLACE) TO PRT-FEE-PAID

  MOVE BAD-FEE-TAKING-TEST(BAD-RECORD-PLACE) TO PRT-FEE

  MOVE BAD-SCORE(BAD-RECORD-PLACE) TO BAD-SCORE-EXAM

  MOVE BAD-CORRECT(BAD-RECORD-PLACE) TO PRT-ITEMS-CORRECT

  MOVE BAD-WRONG(BAD-RECORD-PLACE) TO PRT-ITEMS-WRONG

  MOVE BAD-MAJOR(BAD-RECORD-PLACE) TO PRT-MAJOR

  MOVE BAD-ERROR-MSG(BAD-RECORD-PLACE,1)

                                     TO PRT-ERROR-MESSAGE

  WRITE PRINT-REC FROM OUTPUT-REC

       AFTER ADVANCING 2 LINES.

       MOVE SPACES TO OUTPUT-REC.

     PERFORM 3035-PRINT-ERROR-MSG

        VARYING WHAT-BAD-ERROR  FROM 2 BY 1

     UNTIL WHAT-BAD-ERROR > BAD-NUM-MSG(BAD-RECORD-PLACE)

        VARYING BAD-RECORD-PLACE2  FROM 2 BY 1

     UNTIL BAD-RECORD-PLACE2 > BAD-RECORD-COUNT

   .

 

3035-PRINT-ERROR-MSG.

 MOVE BAD-ERROR-MSG(BAD-RECORD-PLACE,WHAT-BAD-ERROR)

                                      TO PRT-ERROR-MESSAGE

  WRITE PRINT-REC FROM OUTPUT-REC

   AFTER ADVANCING 1 LINE

 .

 

3070-FIND-GRADE.

    DISPLAY 'WRONG' GOOD-WRONG(GOOD-RECORD-COUNT)

    CALL 'GRADE' USING GOOD-TABLE

    MOVE SPACES TO OUTPUT-REC

    WRITE PRINT-REC FROM OUTPUT-REC AFTER 3

 

    PERFORM 3000-PRINT-VALID-RECORD

        VARYING GOOD-RECORD-PLACE FROM 1 BY 1

           UNTIL GOOD-RECORD-PLACE > GOOD-RECORD-COUNT

 

    .

 

 

3080-SORT.

   MOVE "LDJHLFJHLDSFlkjasldf" to OUTPUT-REC

   CALL 'BUB-SORT' USING GOOD-TABLE

   MOVE SPACES TO OUTPUT-REC

   WRITE PRINT-REC FROM OUTPUT-REC AFTER 3

 

   PERFORM 3000-PRINT-VALID-RECORD

       VARYING GOOD-RECORD-PLACE FROM 1 BY 1

          UNTIL GOOD-RECORD-PLACE > GOOD-RECORD-COUNT

     .

 

3090-MAJOR-FIND.

    CALL 'MAJORS' USING GOOD-TABLE

    MOVE SPACES TO OUTPUT-REC

    WRITE PRINT-REC FROM OUTPUT-REC AFTER 3

    PERFORM 3000-PRINT-VALID-RECORD

       VARYING GOOD-RECORD-PLACE FROM 1 BY 1

          UNTIL GOOD-RECORD-PLACE > GOOD-RECORD-COUNT

     .

 

4000-CLOSE-FILES.

     CLOSE TEST-RESULTS-FILE, PRINT-FILE

     STOP RUN

 

 

 

 

SubProgram:

       ENVIRONMENT DIVISION.

      *YOU DON'T NEED ANYTHING FOR THIS SUBROUTINE.

      *

       DATA DIVISION.

       WORKING-STORAGE SECTION.

       01  WS-GRADE.

           05  X                PIC 9(03).

           05  Y                PIC 9(03).

           05  TOTAL-GRADE      PIC 9(03).

           05  TOTAL-ITEMS      PIC 9(04).

           05  TEST-SCORE       PIC 9(03).

 

       LINKAGE SECTION.

       01 GOOD-TABLE.

          05 GOOD-RECORD-COUNT   PIC 9(02).

          05 GOOD-RECORD-TABLE OCCURS 35 TIMES.

               10 GOOD-NAME                PIC X(21).

               10 GOOD-CORRECT             PIC 9(03).

               10 GOOD-WRONG               PIC 9(03).

               10 GOOD-FEE-TAKING-TEST     PIC 9(3)V99.

               10 GOOD-FEE-PAID            PIC X.

               10 GOOD-SCORE               PIC 9(03)V9.

               10 GOOD-MAJOR               PIC X(4).

 

       PROCEDURE DIVISION USING GOOD-TABLE.

       0000-MAIN.

           PERFORM 1000-COMPUTE-TEST-GRADE

               VARYING X FROM 1 BY 1

                   UNTIL X > GOOD-RECORD-COUNT.

           PERFORM 7000-END-RTN.

 

       1000-COMPUTE-TEST-GRADE.

           DISPLAY 'WRONG' GOOD-WRONG(X)

           DISPLAY 'CORRECT' GOOD-CORRECT(X)

           COMPUTE TOTAL-ITEMS = GOOD-WRONG(X) + GOOD-CORRECT(X)

           COMPUTE TEST-SCORE =  GOOD-CORRECT(X) / TOTAL-ITEMS

          .

 

       7000-END-RTN.

           EXIT PROGRAM.

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following