这个返回代码是什么意思? IGYPS0009-E

时间:2017-12-21 22:36:32

标签: cobol mainframe

我正在编写COBOL代码并且无法弄清楚为什么这个错误代码会读取

  

" OPEN"不应该开始在区域" A"。它被处理好像在区域" B"

中一样

具体而言,它指的是PROCEDURE DIVISION

OPEN INPUT CUST-PROF下的一行
      *-----------------------
       IDENTIFICATION DIVISION.
      *-----------------------
       PROGRAM-ID.    FSOC050
      *--------------------
       ENVIRONMENT DIVISION.
      *--------------------
       INPUT-OUTPUT SECTION.
      *
       FILE-CONTROL.
           SELECT CUST-PROF  ASSIGN TO CUSTPROF
                  ORGANIZATION IS SEQUENTIAL.
      *-------------
       DATA DIVISION.
      *-------------
       FILE SECTION.
       FD  CUST-PROF RECORDING MODE F.
       01  CUST-PROF-01.
           05  CUST-NO             PIC X(6).
           05  CUST-NAME           PIC X(35).
           05  CUST-STREET-ADDR    PIC X(25).
           05  CUST-CITY           PIC X(11).
           05  CUST-STATE          PIC X(2).
           05  CUST-CARD-TYPE      PIC X(4).
           05  CUST-CARD-EXP-MO    PIC X(2).
           05  CUST-CARD-EXP-YR    PIC X(2).
           05  CUST-CARD-NO        PIC X(19).
           05  FILLER              PIC X(21).
      *
       WORKING-STORAGE SECTION.
       01 CUST-NO-SRCH               PIC X(6).
       01 FLAGS.
           05 LASTREC                PIC X VALUE 'N'.
              88 LAST-REC                  VALUE 'Y'.
      *------------------
       PROCEDURE DIVISION.
      *------------------
       OPEN-FILES.
           ACCEPT CUST-NO-SRCH.
      *
           DISPLAY "SEARCH RECORDS FOR " CUST-NO-SRCH.
      *
        OPEN INPUT  CUST-PROF.
      *
           PERFORM UNTIL LAST-REC
              READ CUST-PROF
                 AT END SET LAST-REC TO TRUE
                 NOT AT END
                 IF CUST-NO-SRCH = CUST-NO
                   DISPLAY "CUSTOMER NAME = "
                    CUST-NAME
                 END-IF
              END-READ
           END-PERFORM.
      *
           CLOSE CUST-PROF.
           STOP RUN.
      *

1 个答案:

答案 0 :(得分:4)

我已将您的问题编辑为代码缩进,以显示违规行(您已经看过):

        OPEN INPUT  CUST-PROF.

如果缩进对您来说看起来不一样,则代码可能包含标签。

回到问题:

  

为什么这个错误代码读取

     
    

“OPEN”不应该在区域“A”中开始。处理就像在“B”区域中找到的一样。

  

编译器检查ANSI COBOL 85规则:语句应该从区域B开始:

Columns  Field                Description
1-6      Sequence Area        Often empty or line numbers, look out for shop specific rules
7        Indicator            Asterisk (*) = comment line, Hyphen (-) = continuation line,
                              Slash ( / ) = form feed, D = debugging line
8-11     Area A               COBOL definitions: divisions, sections, paragraphs, records and
                              some other entries must *begin* in Area A
12-72    Area B               everything else, including COBOL statements, must begin in area B
73-nn    Identification Area  may contain notes, look out for shop specific rules

编译器说:我很好地猜测这一行是一个以OPEN语句开头的有效行。