Question
My COBOL Program is having three errors with PERFORM WRITE-HEADING-LINE, WRITE HEADING-LINE, End Read and I can not figure out how to fix them, please
My COBOL Program is having three errors with PERFORM WRITE-HEADING-LINE, WRITE HEADING-LINE, End Read and I can not figure out how to fix them, please help. Here is the code:
ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT STUDENT-FILE ASSIGN TO 'C:\Cobol I\C1004.DAT' ORGANIZATION IS LINE SEQUENTIAL. SELECT OUTPUT-REPORT ASSIGN TO 'C:\Cobol I\STDREPORT.TXT' ORGANIZATION IS LINE SEQUENTIAL. DATA DIVISION. FILE SECTION.
FD STUDENT-FILE RECORD CONTAINS 38 CHARACTERS DATA RECORD IS STUDENT-IN. 01 STUDENT-IN. 05 SOC-SEC-NO-IN PIC X(9). 05 NAME-IN PIC X(21). 05 CLASS-IN PIC X. 05 SCHOOL-IN PIC X. 05 GPA-IN PIC 9V99. 05 CREDITS-IN PIC 9(3). FD OUTPUT-REPORT RECORD CONTAINS 80 CHARACTERS DATA RECORD IS PRINT-LINE. 01 PRINT-LINE PIC X(80). WORKING-STORAGE SECTION.
01 ANY-MORE-RECORDS PIC X(1) VALUE 'Y'.
01 HEADING-LINE.
05 FILLER PIC X(9) VALUE 'SSNO'. 05 FILLER PIC X(5) VALUE SPACES. 05 FILLER PIC X(21) VALUE 'STUDENT NAME'. 05 FILLER PIC X(5) VALUE SPACES. 05 FILLER PIC X(10) VALUE 'CLASS'. 05 FILLER PIC X(5) VALUE SPACES. 05 FILLER PIC X(15) VALUE 'SCHOOL'. 05 FILLER PIC X(5) VALUE SPACES. 05 FILLER PIC X(5) VALUE 'GPA'. 05 FILLER PIC X(5) VALUE SPACES. 05 FILLER PIC X(10) VALUE 'CREDITS'.
01 DETAIL-LINE. 05 SSNO-OUT PIC X(9). 05 FILLER PIC X(5) VALUE SPACES. 05 NAME-OUT PIC X(21). 05 FILLER PIC X(5) VALUE SPACES. 05 CLASS-OUT PIC X(10). 05 FILLER PIC X(5) VALUE SPACES. 05 SCHOOL-OUT PIC X(15). 05 FILLER PIC X(5) VALUE SPACES. 05 GPA-OUT PIC 9V99. 05 FILLER PIC X(5) VALUE SPACES. 05 CREDITS-OUT PIC 9(3).
PROCEDURE DIVISION. PREPARE-OUTPUT-REPORT. OPEN INPUT STUDENT-FILE OUTPUT OUTPUT-REPORT. PERFORM WRITE-HEADING-LINE PERFORM PROCESS-RECORD UNTIL ANY-MORE-RECORDS = 'N'. CLOSE STUDENT-FILE OUTPUT-REPORT. STOP RUN. WRITE HEADING-LINE MOVE HEADING-LINE TO PRINT-LINE WRITE PRINT-LINE. PROCESS-RECORD. READ STUDENT-FILE AT END MOVE 'N' TO ANY-MORE-RECORDS NOT AT END MOVE SOC-SEC-NO-IN TO SSNO-OUT MOVE NAME-IN TO NAME-OUT IF CLASS-IN = 1 THEN
MOVE "Freshman" TO CLASS-OUT
END-IF
IF CLASS-IN = 2 THEN
MOVE "Sophomore" TO CLASS-OUT
END-IF
IF CLASS-IN = 3 THEN
MOVE "Junior" TO CLASS-OUT
END-IF
IF CLASS-IN = 4 THEN
MOVE "Senior" TO CLASS-OUT
END-IF
IF SCHOOL-IN = 1 THEN
MOVE "Business" TO SCHOOL-OUT
END-IF
IF SCHOOL-IN = 2 THEN
MOVE "Liberal Arts" TO SCHOOL-OUT
END-IF
IF SCHOOL-IN = 3 THEN
MOVE "Engineering" TO SCHOOL-OUT
END-IF MOVE GPA-IN TO GPA-OUT. MOVE CREDITS-IN TO CREDITS-OUT MOVE DETAIL-LINE TO PRINT-LINE WRITE PRINT-LINE END read.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started