COBOL文件结尾open-cobol

时间:2017-01-15 22:02:47

标签: cobol

我对cobol中的程序有问题。我在ubuntu中使用open cobol就像这样:

cobc -free -x -o hrm hrm_backup.cbl

当我尝试编译代码时,我得到了这个:

  

hrm_backup.cbl:在段落' EMPPERSONAL-PARA':hrm_backup.cbl:1293:   错误:语法错误,意外"文件结束",期待" END PROGRAM"   或" PROGRAM-ID"

该程序的代码是这样的(缩写):

       IDENTIFICATION DIVISION.
   PROGRAM-ID. MAINHRMS.

   DATA DIVISION.
   WORKING-STORAGE SECTION.
   77 CHOICE PIC 9.

   PROCEDURE DIVISION.
   MAIN-PARA.
       DISPLAY " " WITH BLANK SCREEN.
       DISPLAY "*******************************************" LINE 3 COL 15.
       DISPLAY "     HUMAN RESOURCE MANAGEMENT SYSTEM      " LINE 5 COL 15.
       DISPLAY "*******************************************" LINE 7 COL 15.
       DISPLAY "1. HRMS WRITE" LINE 10 COL 25.
       DISPLAY "2. HRMS READ" LINE 12 COL 25.
       DISPLAY "3. LIST BRANCH FILE" LINE 14 COL 25.
       DISPLAY "4. EXIT" LINE 16 COL 25.
       DISPLAY "ENTER YOUR CHOICE :" LINE 18 COL 25.
       ACCEPT CHOICE LINE 18 COL 46.
       IF CHOICE = 1
          CALL "EMPWRITE"
          CANCEL "EMPWRITE"
          GO TO MAIN-PARA
       ELSE
         IF CHOICE = 2
            CALL "EMPREAD"
            CANCEL "EMPREAD"
            GO TO MAIN-PARA
         ELSE
            STOP RUN.

   IDENTIFICATION DIVISION.
   PROGRAM-ID. EMPREAD.

   ENVIRONMENT DIVISION.
   INPUT-OUTPUT SECTION.
   FILE-CONTROL.
       SELECT EMPFILE ASSIGN TO DISK
       ORGANIZATION IS INDEXED
       ACCESS MODE IS DYNAMIC
       RECORD KEY IS EEMPID
       FILE STATUS IS FSE.

       SELECT LEAVEFILE ASSIGN TO DISK
       ORGANIZATION IS INDEXED
       ACCESS MODE IS DYNAMIC
       RECORD KEY IS LEMPID
       FILE STATUS IS FSL.

       SELECT BRANCHFILE ASSIGN TO DISK
       ORGANIZATION IS INDEXED
       ACCESS MODE IS DYNAMIC
       RECORD KEY IS BBRID
       FILE STATUS IS FSB.

       SELECT DESIGNATIONFILE ASSIGN TO DISK
       ORGANIZATION IS SEQUENTIAL
       ACCESS MODE IS SEQUENTIAL
       FILE STATUS IS FSDES.

       SELECT DEPARTMENTFILE ASSIGN TO DISK
       ORGANIZATION IS INDEXED
       ACCESS MODE IS DYNAMIC
       RECORD KEY IS DEPCODE
       FILE STATUS IS FSDEP.

       SELECT REVISIONFILE ASSIGN TO DISK
       ORGANIZATION IS INDEXED
       ACCESS MODE IS DYNAMIC
       RECORD KEY IS RREVID
       ALTERNATE RECORD KEY IS REMPID
       FILE STATUS IS FSR.

       SELECT PAYMENTFILE ASSIGN TO DISK
       ORGANIZATION IS INDEXED
       ACCESS MODE IS DYNAMIC
       RECORD KEY IS PEMPID
       FILE STATUS IS FSP.

       SELECT CONFIRMATIONFILE ASSIGN TO DISK
       ORGANIZATION IS INDEXED
       ACCESS MODE IS DYNAMIC
       RECORD KEY IS CCONID
       ALTERNATE RECORD KEY IS CEMPID
       FILE STATUS IS FSC.

       SELECT GRADEFILE ASSIGN TO DISK
       ORGANIZATION IS SEQUENTIAL
       ACCESS MODE IS SEQUENTIAL
       FILE STATUS IS FSG.

       SELECT TRANSFERFILE ASSIGN TO DISK
       ORGANIZATION IS INDEXED
       ACCESS MODE IS DYNAMIC
       RECORD KEY IS TTRFID
       FILE STATUS IS FST.

       SELECT EMPPERSONALFILE ASSIGN TO DISK
       ORGANIZATION IS INDEXED
       ACCESS MODE IS DYNAMIC
       RECORD KEY IS EPEMPID
       FILE STATUS IS FSEP.

   DATA DIVISION.
   FILE SECTION.
   FD EMPFILE
       LABEL RECORDS ARE STANDARD
       VALUE OF FILE-ID IS "EMP.DAT".
   01 EMPREC.
       02 EEMPID    PIC X(6).
       02 EEMPNAME  PIC X(25).
       02 EEMPADDR  PIC X(30).
       02 EPHONE    PIC X(10).
       02 EDOJ      PIC X(10).
       02 EDIP      PIC X(10).
       02 EUG       PIC X(4).
       02 EPG       PIC X(4).
       02 EPROFQ    PIC X(4).
       02 ESKILL    PIC X(10).
       02 EGRDNO    PIC 99.
       02 EBRNID    PIC X(6).
       02 EDESID    PIC X(6).

   FD LEAVEFILE
       LABEL RECORDS ARE STANDARD
       VALUE OF FILE-ID IS "LEAVE.DAT".
   01 LEAVEREC.
       02 LEMPID    PIC X(6).
       02 LFMDATE   PIC X(10).
       02 LTODATE   PIC X(10).
       02 LLEVCAT   PIC X(3).

   FD BRANCHFILE
       LABEL RECORDS ARE STANDARD
       VALUE OF FILE-ID IS "BRANCH.DAT".
   01 BRANCHREC.
       02 BBRID    PIC X(6).
       02 BBRNAME  PIC X(15).
       02 BBRADD   PIC X(30).
       02 BBRPH    PIC X(10).
       02 BEMAIL   PIC X(20).
       02 BMGRNAME PIC X(25).

   FD DESIGNATIONFILE
       LABEL RECORDS ARE STANDARD
       VALUE OF FILE-ID IS "DESIG.DAT".
   01 DESIGNATIONREC.
       02 DESID    PIC X(6).
       02 DESIGN   PIC X(15).
       02 DESHRT   PIC X(4).

   FD DEPARTMENTFILE
       LABEL RECORDS ARE STANDARD
       VALUE OF FILE-ID IS "DEPART.DAT".
   01 DEPARTMENTREC.
       02 DEPCODE  PIC X(6).
       02 DEPNAME  PIC X(20).

   FD REVISIONFILE
       LABEL RECORDS ARE STANDARD
       VALUE OF FILE-ID IS "REVISION.DAT".
   01 REVISIONREC.
       02 RREVID   PIC X(6).
       02 REMPID   PIC X(6).
       02 RDESCODE PIC X(6).
       02 RBASIC   PIC 9(6)V99.
       02 RHRA     PIC 9(6)V99.
       02 RDPA     PIC 9(6)V99.
       02 RPPA     PIC 9(6)V99.
       02 REDUA    PIC 9(6)V99.
       02 RTECHJR  PIC 9(6)V99.
       02 RLUNCHA  PIC 9(6)V99.
       02 RCONVEY  PIC 9(6)V99.
       02 RBUSATR  PIC 9(6)V99.
       02 RLTA     PIC 9(6)V99.
       02 RPF      PIC 9(6)V99.
       02 RESI     PIC 9(6)V99.
       02 RREVDATE PIC X(10).

   FD PAYMENTFILE
       LABEL RECORDS ARE STANDARD
       VALUE OF FILE-ID IS "PAYMENT.DAT".
   01 PAYMENTREC.
       02 PEMPID   PIC X(6).
       02 PBASIC   PIC 9(6)V99.
       02 PDA      PIC 9(6)V99.
       02 PCCA     PIC 9(6)V99.
       02 PHRA     PIC 9(6)V99.
       02 PDPA     PIC 9(6)V99.
       02 PPPA     PIC 9(6)V99.
       02 PEDUA    PIC 9(6)V99.
       02 PTECHJR  PIC 9(6)V99.
       02 PLUNCHA  PIC 9(6)V99.
       02 PCONVEY  PIC 9(6)V99.
       02 PBUSATR  PIC 9(6)V99.
       02 PLTA     PIC 9(6)V99.
       02 PPF      PIC 9(6)V99.
       02 PESI     PIC 9(6)V99.
       02 PGRTY    PIC 9(6)V99.
       02 PPTAX    PIC 9(6)V99.
       02 PITAX    PIC 9(6)V99.
       02 PLOAN    PIC 9(8)V99.
       02 PLOANDA  PIC 9(8)V99.
       02 POTHERD  PIC 9(6)V99.
       02 PPERINC  PIC 9(6)V99.
       02 PMEDI    PIC 9(6)V99.
       02 PBOOK    PIC 9(6)V99.
       02 PENTER   PIC 9(6)V99.
       02 PTPH     PIC 9(6)V99.
       02 PHOUSE   PIC 9(6)V99.
       02 PVEHMAN  PIC 9(6)V99.
       02 PCREDIT  PIC 9(6)V99.
       02 PCLUB    PIC 9(6)V99.
       02 PCL      PIC 99.
       02 PSL      PIC 99.
       02 PPL      PIC 99.
       02 PLLOP    PIC 999.
       02 POTHERL  PIC 999.

   FD CONFIRMATIONFILE
       LABEL RECORDS ARE STANDARD
       VALUE OF FILE-ID IS "CONFIRM.DAT".
   01 CONFIRMATIONREC.
       02 CCONID   PIC X(6).
       02 CEMPID   PIC X(6).
       02 CCDATE   PIC X(6).

   FD GRADEFILE
       LABEL RECORDS ARE STANDARD
       VALUE OF FILE-ID IS "GRADE.DAT".
   01 GRADEREC.
       02 GGRADE   PIC 99.
       02 GDESIGN  PIC X(25).

   FD TRANSFERFILE
       LABEL RECORDS ARE STANDARD
       VALUE OF FILE-ID IS "TRANSFER.DAT".
   01 TRANSFERREC.
       02 TTRFID   PIC X(6).
       02 TEMPID   PIC X(6).
       02 TOBRID   PIC X(6).
       02 TTRFDT   PIC X(10).

   FD EMPPERSONALFILE
       LABEL RECORDS ARE STANDARD
       VALUE OF FILE-ID IS "EMPPER.DAT".
   01 EMPPERSONALREC.
       02 EPEMPID  PIC X(6).
       02 EPTADD   PIC X(30).
       02 EPTPH    PIC X(10).
       02 EPDOB    PIC X(10).
       02 EPPOB    PIC X(10).
       02 EPLANG   PIC X(15).
       02 EPBLOOD  PIC X(4).
       02 EPWEIGHT PIC 999.
       02 EPHEIGHT PIC 999.
       02 EPVISION PIC X(15).
       02 EPFATHER PIC X(25).
       02 EPDOBF   PIC X(10).
       02 EPMOTHER PIC X(25).
       02 EPDOBM   PIC X(10).
       02 EPSPOUSE PIC X(25).
       02 EPCHILD  PIC X(25).
       02 EPDOBC   PIC X(10).

   WORKING-STORAGE SECTION.
   77 FSE   PIC XX.
   77 FSL   PIC XX.
   77 FSB   PIC XX.
   77 FSDES PIC XX.
   77 FSDEP PIC XX.
   77 FSR   PIC XX.
   77 FSP   PIC XX.
   77 FSC   PIC XX.
   77 FSG   PIC XX.
   77 FST   PIC XX.
   77 FSEP  PIC XX.
   77 DES   PIC X(6).
   77 GR    PIC 99.
   77 CHOICE PIC 99.

   PROCEDURE DIVISION.
   MAIN-PARA.
       DISPLAY " " WITH BLANK SCREEN.
       DISPLAY "*******************************************" LINE 3 COL 10.
       DISPLAY "     HUMAN RESOURCE MANAGEMENT SYSTEM      " LINE 5 COL 10.
       DISPLAY "*******************************************" LINE 7 COL 10.
       DISPLAY " 1. EMPLOYEE FILE" LINE 11 COL 5.
       DISPLAY " 2. LEAVE FILE" LINE 12 COL 5.
       DISPLAY " 3. BRANCH FILE" LINE 13 COL 5.
       DISPLAY " 4. DESIGNATION FILE" LINE 14 COL 5.
       DISPLAY " 5. DEPARTMENT FILE" LINE 15 COL 5.
       DISPLAY " 6. REVISION FILE" LINE 16 COL 5.
       DISPLAY " 7. PAYMENT FILE" LINE 17 COL 5.
       DISPLAY " 8. CONFIRMATION FILE" LINE 18 COL 5.
       DISPLAY " 9. GRADE FILE" LINE 19 COL 5.
       DISPLAY "10. TRANSFER FILE" LINE 20 COL 5.
       DISPLAY "11. EMPLOYEE PERSONAL FILE" LINE 21 COL 5.
       DISPLAY "12. EXIT" LINE 22 COL 5.
       DISPLAY "ENTER U R CHOICE :" LINE 23 COL 5.
       ACCEPT CHOICE LINE 23 COL 45.
       IF CHOICE = 1
          GO TO EMP-PARA
       ELSE
         IF CHOICE = 2
            GO TO LEAVE-PARA
         ELSE
           IF CHOICE = 3
              GO TO BRANCH-PARA
           ELSE
             IF CHOICE = 4
                GO TO DESIGNATION-PARA
             ELSE
               IF CHOICE = 5
                  GO TO DEPARTMENT-PARA
               ELSE
                 IF CHOICE = 6
                    GO TO REVISION-PARA
                 ELSE
                   IF CHOICE = 7
                      GO TO PAYMENT-PARA
                   ELSE
                      IF CHOICE = 8
                         GO TO CONFIRMATION-PARA
                      ELSE
                        IF CHOICE = 9
                           GO TO GRADE-PARA
                        ELSE
                          IF CHOICE = 10
                             GO TO TRANSFER-PARA
                          ELSE
                            IF CHOICE = 11
                               GO TO EMPPERSONAL-PARA
                             ELSE
                               EXIT PROGRAM.

   ...

   ERROR-EMPPERSONAL-PARA.
       CLOSE EMPPERSONALFILE.
       DISPLAY " " WITH BLANK SCREEN.
       DISPLAY "INVALID CODE" LINE 12 COL 30.
       DISPLAY
         "PRESS ENTER TO RETURN TO HRMS READ MENU" LINE 20 COL 10.
       STOP ' '.
       GO TO MAIN-PARA.

   IDENTIFICATION DIVISION.
   PROGRAM-ID. EMPWRITE.

   ENVIRONMENT DIVISION.
   INPUT-OUTPUT SECTION.
   FILE-CONTROL.
       SELECT EMPFILE ASSIGN TO DISK
       ORGANIZATION IS INDEXED
       ACCESS MODE IS DYNAMIC
       RECORD KEY IS EEMPID
       FILE STATUS IS FSO.

       SELECT LEAVEFILE ASSIGN TO DISK
       ORGANIZATION IS INDEXED
       ACCESS MODE IS DYNAMIC
       RECORD KEY IS LEMPID
       FILE STATUS IS FSL.

       SELECT BRANCHFILE ASSIGN TO DISK
       ORGANIZATION IS INDEXED
       ACCESS MODE IS DYNAMIC
       RECORD KEY IS BBRID
       FILE STATUS IS FSB.

       SELECT DESIGNATIONFILE ASSIGN TO DISK
       ORGANIZATION IS SEQUENTIAL
       ACCESS MODE IS SEQUENTIAL
       FILE STATUS IS FSDES.

       SELECT DEPARTMENTFILE ASSIGN TO DISK
       ORGANIZATION IS INDEXED
       ACCESS MODE IS DYNAMIC
       RECORD KEY IS DEPCODE
       FILE STATUS IS FSDEP.

       SELECT REVISIONFILE ASSIGN TO DISK
       ORGANIZATION IS INDEXED
       ACCESS MODE IS DYNAMIC
       RECORD KEY IS RREVID
       ALTERNATE RECORD KEY IS REMPID
       FILE STATUS IS FSR.

       SELECT PAYMENTFILE ASSIGN TO DISK
       ORGANIZATION IS INDEXED
       ACCESS MODE IS DYNAMIC
       RECORD KEY IS PEMPID
       FILE STATUS IS FSP.

       SELECT CONFIRMATIONFILE ASSIGN TO DISK
       ORGANIZATION IS INDEXED
       ACCESS MODE IS DYNAMIC
       RECORD KEY IS CCONID
       ALTERNATE RECORD KEY IS CEMPID
       FILE STATUS IS FSC.

       SELECT GRADEFILE ASSIGN TO DISK
       ORGANIZATION IS SEQUENTIAL
       ACCESS MODE IS SEQUENTIAL
       FILE STATUS IS FSG.

       SELECT TRANSFERFILE ASSIGN TO DISK
       ORGANIZATION IS INDEXED
       ACCESS MODE IS DYNAMIC
       RECORD KEY IS TTRFID
       FILE STATUS IS FST.

       SELECT EMPPERSONALFILE ASSIGN TO DISK
       ORGANIZATION IS INDEXED
       ACCESS MODE IS DYNAMIC
       RECORD KEY IS EPEMPID
       FILE STATUS IS FSEP.

   DATA DIVISION.
   FILE SECTION.
   FD EMPFILE
       LABEL RECORDS ARE STANDARD
       VALUE OF FILE-ID IS "EMP.DAT".
   01 EMPREC.
       02 EEMPID    PIC X(6).
       02 EEMPNAME  PIC X(25).
       02 EEMPADDR  PIC X(30).
       02 EPHONE    PIC X(10).
       02 EDOJ      PIC X(10).
       02 EDIP      PIC X(10).
       02 EUG       PIC X(4).
       02 EPG       PIC X(4).
       02 EPROFQ    PIC X(4).
       02 ESKILL    PIC X(10).
       02 EGRDNO    PIC 99.
       02 EBRNID    PIC X(6).
       02 EDESID    PIC X(6).

   FD LEAVEFILE
       LABEL RECORDS ARE STANDARD
       VALUE OF FILE-ID IS "LEAVE.DAT".
   01 LEAVEREC.
       02 LEMPID    PIC X(6).
       02 LFMDATE   PIC X(10).
       02 LTODATE   PIC X(10).
       02 LLEVCAT   PIC X(3).

   FD BRANCHFILE
       LABEL RECORDS ARE STANDARD
       VALUE OF FILE-ID IS "BRANCH.DAT".
   01 BRANCHREC.
       02 BBRID    PIC X(6).
       02 BBRNAME  PIC X(15).
       02 BBRADD   PIC X(30).
       02 BBRPH    PIC X(10).
       02 BEMAIL   PIC X(20).
       02 BMGRNAME PIC X(25).

   FD DESIGNATIONFILE
       LABEL RECORDS ARE STANDARD
       VALUE OF FILE-ID IS "DESIG.DAT".
   01 DESIGNATIONREC.
       02 DESID    PIC X(6).
       02 DESIGN   PIC X(15).
       02 DESHRT   PIC X(4).

   FD DEPARTMENTFILE
       LABEL RECORDS ARE STANDARD
       VALUE OF FILE-ID IS "DEPART.DAT".
   01 DEPARTMENTREC.
       02 DEPCODE  PIC X(6).
       02 DEPNAME  PIC X(20).

   FD REVISIONFILE
       LABEL RECORDS ARE STANDARD
       VALUE OF FILE-ID IS "REVISION.DAT".
   01 REVISIONREC.
       02 RREVID   PIC X(6).
       02 REMPID   PIC X(6).
       02 RDESCODE PIC X(6).
       02 RBASIC   PIC 9(6)V99.
       02 RHRA     PIC 9(6)V99.
       02 RDPA     PIC 9(6)V99.
       02 RPPA     PIC 9(6)V99.
       02 REDUA    PIC 9(6)V99.
       02 RTECHJR  PIC 9(6)V99.
       02 RLUNCHA  PIC 9(6)V99.
       02 RCONVEY  PIC 9(6)V99.
       02 RBUSATR  PIC 9(6)V99.
       02 RLTA     PIC 9(6)V99.
       02 RPF      PIC 9(6)V99.
       02 RESI     PIC 9(6)V99.
       02 RREVDATE PIC X(10).

   FD PAYMENTFILE
       LABEL RECORDS ARE STANDARD
       VALUE OF FILE-ID IS "PAYMENT.DAT".
   01 PAYMENTREC.
       02 PEMPID   PIC X(6).
       02 PBASIC   PIC 9(6)V99.
       02 PDA      PIC 9(6)V99.
       02 PCCA     PIC 9(6)V99.
       02 PHRA     PIC 9(6)V99.
       02 PDPA     PIC 9(6)V99.
       02 PPPA     PIC 9(6)V99.
       02 PEDUA    PIC 9(6)V99.
       02 PTECHJR  PIC 9(6)V99.
       02 PLUNCHA  PIC 9(6)V99.
       02 PCONVEY  PIC 9(6)V99.
       02 PBUSATR  PIC 9(6)V99.
       02 PLTA     PIC 9(6)V99.
       02 PPF      PIC 9(6)V99.
       02 PESI     PIC 9(6)V99.
       02 PGRTY    PIC 9(6)V99.
       02 PPTAX    PIC 9(6)V99.
       02 PITAX    PIC 9(6)V99.
       02 PLOAN    PIC 9(8)V99.
       02 PLOANDA  PIC 9(8)V99.
       02 POTHERD  PIC 9(6)V99.
       02 PPERINC  PIC 9(6)V99.
       02 PMEDI    PIC 9(6)V99.
       02 PBOOK    PIC 9(6)V99.
       02 PENTER   PIC 9(6)V99.
       02 PTPH     PIC 9(6)V99.
       02 PHOUSE   PIC 9(6)V99.
       02 PVEHMAN  PIC 9(6)V99.
       02 PCREDIT  PIC 9(6)V99.
       02 PCLUB    PIC 9(6)V99.
       02 PCL      PIC 99.
       02 PSL      PIC 99.
       02 PPL      PIC 99.
       02 PLLOP    PIC 999.
       02 POTHERL  PIC 999.

   FD CONFIRMATIONFILE
       LABEL RECORDS ARE STANDARD
       VALUE OF FILE-ID IS "CONFIRM.DAT".
   01 CONFIRMATIONREC.
       02 CCONID   PIC X(6).
       02 CEMPID   PIC X(6).
       02 CCDATE   PIC X(6).

   FD GRADEFILE
       LABEL RECORDS ARE STANDARD
       VALUE OF FILE-ID IS "GRADE.DAT".
   01 GRADEREC.
       02 GGRADE   PIC 99.
       02 GDESIGN  PIC X(25).

   FD TRANSFERFILE
       LABEL RECORDS ARE STANDARD
       VALUE OF FILE-ID IS "TRANSFER.DAT".
   01 TRANSFERREC.
       02 TTRFID   PIC X(6).
       02 TEMPID   PIC X(6).
       02 TOBRID   PIC X(6).
       02 TTRFDT   PIC X(10).

   FD EMPPERSONALFILE
       LABEL RECORDS ARE STANDARD
       VALUE OF FILE-ID IS "EMPPER.DAT".
   01 EMPPERSONALREC.
       02 EPEMPID  PIC X(6).
       02 EPTADD   PIC X(30).
       02 EPTPH    PIC X(10).
       02 EPDOB    PIC X(10).
       02 EPPOB    PIC X(10).
       02 EPLANG   PIC X(15).
       02 EPBLOOD  PIC X(4).
       02 EPWEIGHT PIC 999.
       02 EPHEIGHT PIC 999.
       02 EPVISION PIC X(15).
       02 EPFATHER PIC X(25).
       02 EPDOBF   PIC X(10).
       02 EPMOTHER PIC X(25).
       02 EPDOBM   PIC X(10).
       02 EPSPOUSE PIC X(25).
       02 EPCHILD  PIC X(25).
       02 EPDOBC   PIC X(10).

   WORKING-STORAGE SECTION.
   77 FSO   PIC XX.
   77 FSL   PIC XX.
   77 FSB   PIC XX.
   77 FSDES PIC XX.
   77 FSDEP PIC XX.
   77 FSR   PIC XX.
   77 FSP   PIC XX.
   77 FSC   PIC XX.
   77 FSG   PIC XX.
   77 FST   PIC XX.
   77 FSEP  PIC XX.
   77 CHOICE PIC 99.

   PROCEDURE DIVISION.
   MAIN-PARA.
       DISPLAY " " WITH BLANK SCREEN.
       DISPLAY "*******************************************" LINE 3 COL 10.
       DISPLAY "     HUMAN RESOURCE MANAGEMENT SYSTEM      " LINE 5 COL 10.
       DISPLAY "*******************************************" LINE 7 COL 10.
       DISPLAY " 1. EMPLOYEE FILE" LINE 11 COL 5.
       DISPLAY " 2. LEAVE FILE" LINE 12 COL 5.
       DISPLAY " 3. BRANCH FILE" LINE 13 COL 5.
       DISPLAY " 4. DESIGNATION FILE" LINE 14 COL 5.
       DISPLAY " 5. DEPARTMENT FILE" LINE 15 COL 5.
       DISPLAY " 6. REVISION FILE" LINE 16 COL 5.
       DISPLAY " 7. PAYMENT FILE" LINE 17 COL 5.
       DISPLAY " 8. CONFIRMATION FILE" LINE 18 COL 5.
       DISPLAY " 9. GRADE FILE" LINE 19 COL 5.
       DISPLAY "10. TRANSFER FILE" LINE 20 COL 5.
       DISPLAY "11. EMPLOYEE PERSONAL FILE" LINE 21 COL 5.
       DISPLAY "12. EXIT" LINE 22 COL 5.
       DISPLAY "ENTER U R CHOICE :" LINE 23 COL 25.
       ACCEPT CHOICE LINE 23 COL 45.
       IF CHOICE = 1
          GO TO EMP-PARA
       ELSE
         IF CHOICE = 2
            GO TO LEAVE-PARA
         ELSE
           IF CHOICE = 3
              GO TO BRANCH-PARA
           ELSE
             IF CHOICE = 4
                GO TO DESIGNATION-PARA
             ELSE
               IF CHOICE = 5
                  GO TO DEPARTMENT-PARA
               ELSE
                 IF CHOICE = 6
                    GO TO REVISION-PARA
                 ELSE
                   IF CHOICE = 7
                      GO TO PAYMENT-PARA
                   ELSE
                      IF CHOICE = 8
                         GO TO CONFIRMATION-PARA
                      ELSE
                        IF CHOICE = 9
                           GO TO GRADE-PARA
                        ELSE
                          IF CHOICE = 10
                             GO TO TRANSFER-PARA
                          ELSE
                            IF CHOICE = 11
                               GO TO EMPPERSONAL-PARA
                             ELSE
                               EXIT PROGRAM.

   ......

   TRANSFER-PARA.
       DISPLAY " " WITH BLANK SCREEN.
       OPEN I-O TRANSFERFILE.
       IF FST = 30
          OPEN OUTPUT TRANSFERFILE.
       DISPLAY "ENTER TRANSFER CODE :" LINE 1 COL 1.
       ACCEPT TTRFID LINE 1 COL 35.
       DISPLAY "ENTER EMP CODE :" LINE 2 COL 1.
       ACCEPT TEMPID LINE 2 COL 35.
       DISPLAY "ENTER OLD BRANCH CODE :" LINE 3 COL 1.
       ACCEPT TOBRID LINE 3 COL 35.
       DISPLAY "ENTER TRANSFER DATE :" LINE 4 COL 1.
       ACCEPT TTRFDT LINE 4 COL 35.
       WRITE TRANSFERREC.
       CLOSE TRANSFERFILE.
       GO TO MAIN-PARA.

   EMPPERSONAL-PARA.
       DISPLAY " " WITH BLANK SCREEN.
       OPEN I-O EMPPERSONALFILE.
       IF FSEP = 30
          OPEN OUTPUT EMPPERSONALFILE.
       DISPLAY "ENTER EMP CODE :" LINE 1 COL 1.
       ACCEPT EPEMPID LINE 1 COL 35.
       DISPLAY "ENTER TEMP ADDRESS :" LINE 2 COL 1.
       ACCEPT EPTADD LINE 2 COL 35.
       DISPLAY "ENTER PHONE :" LINE 3 COL 1.
       ACCEPT EPTPH LINE 3 COL 35.
       DISPLAY "ENTER DOB :" LINE 4 COL 1.
       ACCEPT EPDOB LINE 4 COL 35.
       DISPLAY "ENTER POB :" LINE 5 COL 1.
       ACCEPT EPPOB LINE 5 COL 35.
       DISPLAY "ENTER LANGUAGE KNOWN :" LINE 6 COL 1.
       ACCEPT EPLANG LINE 6 COL 35.
       DISPLAY "ENTER BLOOD GROUP :" LINE 7 COL 1.
       ACCEPT EPBLOOD LINE 7 COL 35.
       DISPLAY "ENTER WEIGHT :" LINE 8 COL 1.
       ACCEPT EPWEIGHT LINE 8 COL 35.
       DISPLAY "ENTER HEIGHT :" LINE 9 COL 1.
       ACCEPT EPHEIGHT LINE 9 COL 35.
       DISPLAY "ENTER VISION :" LINE 10 COL 1.
       ACCEPT EPVISION LINE 10 COL 35.
       DISPLAY "ENTER FATHER'S NAME :" LINE 11 COL 1.
       ACCEPT EPFATHER LINE 11 COL 35.
       DISPLAY "ENTER DOB OF FATHER :" LINE 12 COL 1.
       ACCEPT EPDOBF LINE 12 COL 35.
       DISPLAY "ENTER MOTHER'S NAME :" LINE 13 COL 1.
       ACCEPT EPMOTHER LINE 13 COL 35.
       DISPLAY "ENTER DOB OF MOTHER :" LINE 14 COL 1.
       ACCEPT EPDOBM LINE 14 COL 35.
       DISPLAY "ENTER SPOUSE NAME :" LINE 15 COL 1.
       ACCEPT EPSPOUSE LINE 15 COL 35.
       DISPLAY "ENTER CHILD NAME :" LINE 16 COL 1.
       ACCEPT EPCHILD LINE 16 COL 35.
       DISPLAY "ENTER DOB OF CHILD :" LINE 17 COL 1.
       ACCEPT EPDOBC LINE 17 COL 35.
       WRITE EMPPERSONALREC.
       CLOSE EMPPERSONALFILE.
       GO TO MAIN-PARA.

有什么想法吗?谢谢!

1 个答案:

答案 0 :(得分:7)

编译器实际上告诉你问题是什么:

  

hrm_backup.cbl:1293:错误:语法错误,意外“文件结束”,期待“END PROGRAM”或“PROGRAM-ID”

您有多个PROGRAM-ID但不是一个END-PROGRAM。解决这个问题,该程序可能会有效。

背景:在COBOL中,您可以在一个源中包含多个程序(所有程序都可以调用所有其他程序并且不共享除EXTERNALPROCEDURE DIVISION USING项之外的任何数据)或嵌套在入口点和可能所有其他项目在标有GLOBAL短语时都是共享的。告诉编译器它是否是另一个的唯一方法是使用END-PROGRAM。 有关详细信息,请参阅Gary Cutlers GnuCOBOL Programmer's Guide部分“嵌套子程序”。

我已经接受了您的计划,并将该部分从IF CHOICE移至....(我猜您的来源实际上已经使用了有效的代码,包括您GO TO的段落。

BTW:这是当前版本的编译器(GnuCOBOL 2.0 rc2)的输出:

  

hrm_backup.cbl:1293:没有匹配END PROGRAM的多个PROGRAM-ID

高度建议不要使用Ubuntu过时的OpenCOBOL 1.1软件包(2009年2月),但目前GnuCOBOL 2.0的候选版本(2016年底,下一个将很快推出)或者至少发布了GnuCOBOL 1.1(2014年1月)。

目前Ubuntu系统中没有适用于较新版本的软件包,因此您必须从源代码构建它们,但这应该不是什么大问题。