I am trying to learn Cobol using Murachs Mainframe Cobol book and GNUCobol 3.1 compiler. Currently I am stuck at Chapter 3, where I am suppose to read from a disk file and generate a report.
I have placed the .dat file in same folder as where I compile the program (and also in a /bin folder in same directory).
When I try to compile the program I receive the following error:
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
Relevant Program code:
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".
Solved the problem ...