I have an assignment for my COBOL programming class that requires me to read input from a file and display it. I'm pretty confused. Anyways I typed in some code that most likely won't even do what I want but I still need it to run. My two files are WORKSHEET2.dat and WORKSHEETOUT2.dat with the former containing the input to display.
It compiles fine for me but whenever I try to run the program it says "4 Illegal File Name" and highlights line 14, the line right below the BEGIN. command. Any advice would be helpful, thanks.
IDENTIFICATION DIVISION. PROGRAM-ID. FILE-DISPLAY. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT WORKSHEET2 ASSIGN TO WORKSHEETOUT2. DATA DIVISION. FILE SECTION. FD WORKSHEET2. 01 NAME1 PIC X(20). WORKING-STORAGE SECTION. PROCEDURE DIVISION. BEGIN. OPEN INPUT WORKSHEET2. READ WORKSHEET2 END-READ DISPLAY NAME1. CLOSE WORKSHEET2 STOP RUN.