编译从磁盘文件读取的 Cobol 程序时出现问题
Problem compiling a Cobol program reading from diskfile
我正在尝试使用 Murachs Mainframe Cobol 书籍和 GNUCobol 3.1 编译器来学习 Cobol。目前我停留在第 3 章,我想在那里读取磁盘文件并生成报告。
我已将 .dat 文件放在与编译程序相同的文件夹中(也放在同一目录中的 /bin 文件夹中)。
当我尝试编译程序时收到以下错误:
rose@eden~/cobol/Programs/Chapter 03 $ cobc -x RPT1000.CBL
RPT1000.CBL:11: error: redefinition of 'CUSTMAST'
RPT1000.CBL:11: error: 'CUSTMAST' previously defined here
RPT1000.CBL:12: error: redefinition of 'SALESRPT'
RPT1000.CBL:12: error: 'SALESRPT' previously defined here
相关程序代码:
IDENTIFICATION DIVISION.
PROGRAM-ID. RPT1000.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT CUSTMAST ASSIGN TO CUSTMAST.
SELECT SALESRPT ASSIGN TO SALESRPT.
DATA DIVISION.
FILE SECTION.
FD CUSTMAST.
01 CUSTOMER-MASTER-RECORD.
05 CM-BRANCH-NUMBER PIC 9(2).
05 CM-SALESREP-NUMBER PIC 9(2).
05 CM-CUSTOMER-NUMBER PIC 9(5).
05 CM-CUSTOMER-NAME PIC X(20).
05 CM-SALES-THIS-YTD PIC S9(5)V9(2).
05 CM-SALES-LAST-YTD PIC S9(5)V9(2).
FD SALESRPT.
01 PRINT-AREA PIC X(132).
SELECT CUSTMAST ASSIGN TO "bin/CUSTMAST.dat".
SELECT SALESRPT ASSIGN TO "bin/SALESRPT.dat".
解决了问题...
我正在尝试使用 Murachs Mainframe Cobol 书籍和 GNUCobol 3.1 编译器来学习 Cobol。目前我停留在第 3 章,我想在那里读取磁盘文件并生成报告。
我已将 .dat 文件放在与编译程序相同的文件夹中(也放在同一目录中的 /bin 文件夹中)。
当我尝试编译程序时收到以下错误:
rose@eden~/cobol/Programs/Chapter 03 $ cobc -x RPT1000.CBL
RPT1000.CBL:11: error: redefinition of 'CUSTMAST'
RPT1000.CBL:11: error: 'CUSTMAST' previously defined here
RPT1000.CBL:12: error: redefinition of 'SALESRPT'
RPT1000.CBL:12: error: 'SALESRPT' previously defined here
相关程序代码:
IDENTIFICATION DIVISION.
PROGRAM-ID. RPT1000.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT CUSTMAST ASSIGN TO CUSTMAST.
SELECT SALESRPT ASSIGN TO SALESRPT.
DATA DIVISION.
FILE SECTION.
FD CUSTMAST.
01 CUSTOMER-MASTER-RECORD.
05 CM-BRANCH-NUMBER PIC 9(2).
05 CM-SALESREP-NUMBER PIC 9(2).
05 CM-CUSTOMER-NUMBER PIC 9(5).
05 CM-CUSTOMER-NAME PIC X(20).
05 CM-SALES-THIS-YTD PIC S9(5)V9(2).
05 CM-SALES-LAST-YTD PIC S9(5)V9(2).
FD SALESRPT.
01 PRINT-AREA PIC X(132).
SELECT CUSTMAST ASSIGN TO "bin/CUSTMAST.dat".
SELECT SALESRPT ASSIGN TO "bin/SALESRPT.dat".
解决了问题...