Sublime Forum

COBOL unexpected end of file error

#1

I am currently working on a lab in my cobol programming class. Its quite funny because most of this code is from the book we are using and i have just modified it to fit the lab description. I compile it and it exits the program with exit code 1 and outputs this:

lab2.cbl:13: Error: PERFORM statement not terminated by END-PERFORM

lab2.cbl:19: Error: syntax error, unexpected end of file
[Finished in 0.0s with exit code 1]

I also even asked my Teacher assistant to help debug this but it seemed to of baffled him too.

here is my code:

IDENTIFICATION DIVISION.
PROGRAM-ID. lab2.

DATA DIVISION.
WORKING-STORAGE SECTION.
01 SALES-TAX		PIC 9V9.
01 SALES-AMOUNT		PIC 999V9.
01 SALES-TOTAL		PIC 999V99.
01 MORE-DATA		PIC X VALUE 'Y'.

PROCEDURE DIVISION.
100-MAIN.
	PERFORM UNTIL MORE-DATA = 'N'
		DISPLAY 'Enter a sales amount ->'
		ACCEPT SALES-AMOUNT
		MULTIPLY .08 BY SALES-AMOUNT GIVING SALES-TAX
		COMPUTE SALES-TOTAL = (SALES-TAX + SALES-AMOUNT)
		DISPLAY 'The total sales is 'SALES-TOTAL
		DISPLAY 'Would you like to run it again (Y or N)?'
		ACCEPT MORE-DATA
	END-PERFORM
	STOP RUN.

Any kind of help would be great.

thank you

0 Likes

#2

I’m not sure it’s the best place here for Cobol support, and you don’t tell us which compiler you are using and whether you are using free mode or not, but it looks like you were caught by a classic mistake, not easy to catch if you don’t have a good highlighting mode :slightly_smiling:

Assuming you are not in free mode, (and the error message you got seems to confirm that), have a look at this :

The ending quote on line 19 is not a closing quote, but a comment (in classic mode, columns 1-6 and 72-80 are comments).

As it seems you are using Sublime text, have a look at rulers.

1 Like