I am trying to finish a program in COBOL (this is only my second program in this language) but I can not understand what I need to do in the last step. The instructions are:1. For the IDENTIFICATION DIVISION include the PROGRAM-ID, AUTHOR, INSTALLATION, DATE-WRITTEN, and DATE-COMPILED.
2. Modify the SELECT PURCHASE-TRANS section of the program to exclude the entire path. That is, instead of writing ‘C:\CHAPTER6\CH6PPB.DAT’ write ‘CH6PPB.DAT’ for this section.
3. Modify the SELECT PURCHASE-REPORT section of the program to exclude the entire path and to name the file as LastnameFirstinitialA2.rpt. That is, instead of writing ‘C:\CHAPTER6\CH6PPB.RPT’ write ‘LastnameFirstinitialA2.rpt’ (e.g., BasilioEA2.rpt) for this section.
4. Modify the program to print the total amount of all purchases for all customers at the end of the report. That is, the sum total of all purchases. I am able to do the first three steps but this step is giving me a great deal of trouble. I have asked my instructor and he said we could use the compute statement or create an identifier and have a running total that displays at the end of the report. I just don't know how to do this. I have been trying for 3 days now on how to fix this problem but it is still not working. Can someone please help?

       IDENTIFICATION DIVISION.
       PROGRAM-ID. THORNTONCA2.
      *****************************************************************
      *    This program creates a purchase report of customers and
      *    their amount of purchase and also prints the total amount
      *    of purchases for all customers at the end of the report.
      *****************************************************************
       AUTHOR.
       INSTALLATION.  CS3320.
       DATE-WRITTEN. JAN.29, 2013.
       DATE-COMPILED.

       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT PURCHASE-TRANS ASSIGN TO 'CH6PPB.DAT'
               ORGANIZATION IS LINE SEQUENTIAL.
           SELECT PURCHASE-REPORT ASSIGN TO 'THORNTONCA2.RPT'
               ORGANIZATION IS LINE SEQUENTIAL.
       DATA DIVISION.
       FILE SECTION.
       FD  PURCHASE-TRANS
           RECORD CONTAINS 32 CHARACTERS.
       01  TRANS-REC-IN.
           05 CUST-NO-IN                       PIC X(5).
           05 CUST-NAME-IN                     PIC X(20).
           05 AMT-OF-PUR-IN                    PIC 9(5)V99.
           05 TOTAL                            PIC 9(5)V99.
       FD  PURCHASE-REPORT
           RECORD CONTAINS 80 CHARACTERS.
       01  PRINT-REC                           PIC X(80).
       WORKING-STORAGE SECTION.
       01  WORK-AREAS.
           05  ARE-THERE-MORE-RECORDS          PIC XXX
                   VALUE 'YES'.
           05  WS-DATE.
               10  WS-YEAR                     PIC 9999.
               10  WS-MONTH                    PIC 99.
               10  WS-DAY                      PIC 99.
           05  WS-PAGE-CT                      PIC 99
                   VALUE ZERO.
           05  WS-LINE-CT                      PIC 99
                   VALUE ZERO.
       01  HDR1-OUT.
           05                                  PIC X(40)
                   VALUE SPACES.
           05                                  PIC X(20)
                   VALUE 'PURCHASE REPORT'.
           05  DATE-OUT.
               10  MONTH-OUT                    PIC 99.
               10                               PIC X
                  VALUE '/'.
               10  DAY-OUT                      PIC 99.
               10                               PIC X
                  VALUE '/'.
               10  YEAR-OUT                    PIC 9999.
           05                                  PIC X(2)
                  VALUE SPACES.
           05                                  PIC X(5)
                  VALUE 'PAGE'.
           05  PAGE-OUT                        PIC Z9.
       01  HDR2-OUT.
           05                                  PIC X(10)
                  VALUE SPACES.
           05                                  PIC X(27)
                  VALUE 'CUSTOMER NO   CUSTOMER NAME'.
           05                                  PIC X(13)
                  VALUE SPACES.
           05                                  PIC X(18)
                  VALUE 'AMOUNT OF PURCHASE'.
       01  DETAIL-REC-OUT.
           05                                  PIC X(13)
                  VALUE SPACES.
           05  CUST-NO-OUT                     PIC X(5).
           05                                  PIC X(6)
                  VALUE SPACES.
           05  CUST-NAME-OUT                   PIC X(20).
           05                                  PIC X(11)
                  VALUE SPACES.
           05  AMT-OF-PUR-OUT                  PIC Z(5).99
                  VALUE SPACES.
       PROCEDURE DIVISION.
      *****************************************************************
      *    All program logic is controlled by
      *        100-MAIN-MODULE
      *****************************************************************
       100-MAIN-MODULE.
           OPEN INPUT  PURCHASE-TRANS
                OUTPUT PURCHASE-REPORT
           MOVE FUNCTION CURRENT-DATE TO WS-DATE
           MOVE WS-MONTH TO MONTH-OUT
           MOVE WS-DAY TO DAY-OUT
           MOVE WS-YEAR TO YEAR-OUT
           PERFORM 200-HDG-RTN.
           PERFORM UNTIL ARE-THERE-MORE-RECORDS = 'NO '
              READ PURCHASE-TRANS
                   AT END
                      MOVE 'NO ' TO ARE-THERE-MORE-RECORDS
                   NOT AT END
                       PERFORM 300-REPORT-RTN
              END-READ
            END-PERFORM
            CLOSE PURCHASE-TRANS
                  PURCHASE-REPORT
            STOP RUN.
      *****************************************************************
      *    200-HDG-RTN is executed once from the main module
      *         and then again after 25 detail lines print
      *****************************************************************
       200-HDG-RTN.
           ADD 1 TO WS-PAGE-CT
           MOVE WS-PAGE-CT TO PAGE-OUT
           WRITE PRINT-REC FROM HDR1-OUT
                AFTER ADVANCING PAGE
           WRITE PRINT-REC FROM HDR2-OUT
                AFTER ADVANCING 2 LINES
           WRITE PRINT-REC FROM HDR3-OUT
                AFTER ADVANCING PAGE
           MOVE ZEROS TO WS-LINE-CT.

      *****************************************************************
      *    300-REPORT-RTN is executed form the main module
      *       until all input records have been processed
      *****************************************************************
       300-REPORT-RTN.
           IF WS-LINE-CT >=25
               PERFORM 200-HDG-RTN
           END-IF
           MOVE CUST-NO-IN TO CUST-NO-OUT
           MOVE CUST-NAME-IN TO CUST-NAME-OUT
           MOVE AMT-OF-PUR-IN TO AMT-OF-PUR-OUT
           WRITE PRINT-REC FROM DETAIL-REC-OUT
               AFTER ADVANCING 2 LINES
           ADD 1 TO WS-LINE-CT.

Arrrgh! About 30 years ago I might have been able to help you, but the last time I had to deal with COBOL was around 1983... I have done all in my power to purge that knowledge from my brain since. :-) The only suggestion I can make right now is to visit our friend Google. Sorry! :-(

P.S. I even got rid of my COBOL and DIBOL books, around 1986 or 87.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.