程序运行但出错

program runs but errors out

我有这个程序可以编译但不能处理。当我启动程序到 运行 时,它到达第 148 行“WRITE BASBALL-RECORD-OUT FROM HEADING-LINE-1”并说它未处理,我该如何解决这个问题。谢谢。

       IDENTIFICATION DIVISION.
       PROGRAM-ID. BASEBALL-2.
      * Andrew Sawyer
      ******************************************************************
      * This program will sort different stats for different baseball
      * players with day, time, and muiltiple pages.
      ******************************************************************
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
 
       SELECT BASEBALL-FILE-IN
           ASSIGN TO 'BASEBALL-2.SEQ'
           ORGANIZATION IS LINE SEQUENTIAL.
 
       SELECT BASEBALL-FILE-OUT
           ASSIGN TO 'BASEBALL-2.RPT'
           ORGANIZATION IS LINE SEQUENTIAL.
 
   DATA DIVISION.
   FILE SECTION.
   FD  BASEBALL-FILE-IN.
   01 BASEBALL-RECORD-OUT          PIC 99.
   
   01 LINE-COUNT                   PIC 99 VALUE ZEROS.
   
   01 WS-DATE.
       05  RUN-YEAR        PIC XX.
       05  RUN-MONTH       PIC XX.
       05  RUN-DAY         PIC XX.
   
   01  HEADING-LINE-1.
       05                  PIC X(24) VALUE SPACES.
       05                  PIC X(26) VALUE 'BASEBALL PLAYER STATS'.
       05                  PIC X(12) VALUE SPACES.
       05  HL-1-DATE.
           10  MONTH-2     PIC XX.
           10              PIC X       VALUE'/'.
           10  DAY-2       PIC XX.
           10              PIC X       VALUE'/'.
           10  YEAR-2      PIC XX.
       05                  PIC X(6)    VALUE SPACES.
       05  PAGE-1          PIC X(4)    VALUE 'PAGE'.
       
   01  HEADING-LINE-2.
       05                  PIC X(6)    VALUE 'LEAGUE'.
       05                  PIC X(3)    VALUE SPACES.
       05                  PIC X(4)    VALUE 'TEAM'.
       05                  PIC X(5)    VALUE SPACES.
       05                  PIC X(4)    VALUE 'NAME'.
       05                  PIC X(10)   VALUE SPACES.
       05                  PIC X(4)    VALUE 'HITS'.
       05                  PIC X(6)    VALUE  SPACES.
       05                  PIC X(7)    VALUE 'AT-BATS'.
   
   FD  BASEBALL-FILE-OUT.
   01  DETAIL-LINE.
       05 BLANK-A-OUT      PIC X       VALUE SPACES.
       05 DL-LEAGUE        PIC XX.
       05 BLANK-B-OUT      PIC X(3)    VALUE SPACES.
       05 DL-TEAM          PIC X(3).
       05 BLANK-C-OUT      PIC X(3)    VALUE SPACES.
       05 DL-NAME          PIC X(10).
       05 BLANK-D-OUT      PIC X(3)    VALUE SPACES.
       05 DL-HITS          PIC ZZ9.
       05 BLANK-E-OUT      PIC X(3)   VALUE SPACES.
       05 DL-AT-BATS       PIC ZZ9.
       
   WORKING-STORAGE SECTION.    
   01  ARE-THERE-MORE-RECORDS      PIC X(3)    VALUE 'YES'.
   
   PROCEDURE DIVISION.
   100-MAIN.
       OPEN INPUT BASEBALL-FILE-IN
       OPEN OUTPUT BASEBALL-FILE-OUT
       
       ACCEPT WS-DATE FROM DATE
       MOVE RUN-MONTH TO MONTH-2
       MOVE RUN-DAY TO DAY-2
       MOVE RUN-YEAR TO YEAR-2
       WRITE BASEBALL-RECORD-OUT FROM HEADING-LINE-1
       
       PERFORM UNTIL ARE-THERE-MORE-RECORDS = 'NO'
           READ BASEBALL-FILE-IN
               AT END
                   MOVE 'NO ' TO ARE-THERE-MORE-RECORDS
               NOT AT END
                   PERFORM 200-PROCESS-ONE-RECORD
           END-READ
       END-PERFORM
 
       CLOSE BASEBALL-FILE-IN
       CLOSE BASEBALL-FILE-OUT
       STOP RUN.
 
   200-PROCESS-ONE-RECORD.
       MOVE 'LEAGUE' TO DL-LEAGUE     
       MOVE SPACES TO BLANK-A-OUT
       MOVE 'TEAM' TO DL-TEAM    
       MOVE SPACES TO BLANK-B-OUT
       MOVE 'NAME' TO DL-NAME
       MOVE SPACES TO BLANK-C-OUT
       MOVE 'HITS' TO DL-HITS
       MOVE SPACES TO BLANK-D-OUT
       MOVE 'AT-BATS' TO DL-AT-BATS
       MOVE SPACES TO BLANK-E-OUT
       WRITE BASEBALL-RECORD-OUT
           AFTER ADVANCING 2 LINES.
           
   300-LINE.
       IF LINE-COUNT >= 50
          PERFORM 400-NEXT-PAGE
       END-IF
       WRITE BASEBALL-RECORD-OUT
       AFTER ADVANCING 1 LINE
       ADD 1 TO LINE-COUNT.
   
   400-NEXT-PAGE.
       WRITE BASEBALL-RECORD-OUT
           AFTER ADVANCING PAGE
       MOVE ZEROS TO LINE-COUNT

我不确定程序是否正确打印数据,我目前只是想编译它。有什么问题请追问。

我尝试使用在线 COBOL 编译器。我能够验证此 DATA DIVISION 已编译。

首先是文件部分,然后是工作存储部分。我排列了 PIC 和 VALUE 子句,以便更容易阅读代码。

DATA DIVISION.
FILE SECTION.
FD  BASEBALL-FILE-IN.
01  BASEBALL-RECORD-IN           PIC 99.

FD  BASEBALL-FILE-OUT.
01  BASEBALL-RECORD-OUT          PIC X(80).

WORKING-STORAGE SECTION. 

01  LINE-COUNT                   PIC 99      VALUE ZEROS.
   
01  WS-DATE.
    05  RUN-YEAR                 PIC XX.
    05  RUN-MONTH                PIC XX.
    05  RUN-DAY                  PIC XX.
    
01  HEADING-LINE-1.
    05                           PIC X(24)   VALUE SPACES.
    05                           PIC X(26)   VALUE 'BASEBALL PLAYER STATS'.
    05                           PIC X(12)   VALUE SPACES.
    05  HL-1-DATE.
        10  MONTH-2              PIC XX.
        10                       PIC X       VALUE'/'.
        10  DAY-2                PIC XX.
        10                       PIC X       VALUE'/'.
        10  YEAR-2               PIC XX.
    05                           PIC X(6)    VALUE SPACES.
    05  PAGE-1                   PIC X(4)    VALUE 'PAGE'.
    
01  HEADING-LINE-2.
    05                           PIC X(6)    VALUE 'LEAGUE'.
    05                           PIC X(3)    VALUE SPACES.
    05                           PIC X(4)    VALUE 'TEAM'.
    05                           PIC X(5)    VALUE SPACES.
    05                           PIC X(4)    VALUE 'NAME'.
    05                           PIC X(10)   VALUE SPACES.
    05                           PIC X(4)    VALUE 'HITS'.
    05                           PIC X(6)    VALUE  SPACES.
    05                           PIC X(7)    VALUE 'AT-BATS'.

01  DETAIL-LINE.
    05  BLANK-A-OUT              PIC X       VALUE SPACES.
    05  DL-LEAGUE                PIC XX.
    05  BLANK-B-OUT              PIC X(3)    VALUE SPACES.
    05  DL-TEAM                  PIC X(3).
    05  BLANK-C-OUT              PIC X(3)    VALUE SPACES.
    05  DL-NAME                  PIC X(10).
    05  BLANK-D-OUT              PIC X(3)    VALUE SPACES.
    05  DL-HITS                  PIC ZZ9.
    05  BLANK-E-OUT              PIC X(3)    VALUE SPACES.
    05  DL-AT-BATS               PIC ZZ9.
    
01  ARE-THERE-MORE-RECORDS       PIC X(3)    VALUE 'YES'.