Thread: COBOL

define certain terms

Started by mxhernandez01 • user1 replies2 viewsLast activity 2 weeks ago
Post #1
0 votes
mxhernandez01
Reputation
0
Posts: 2
Joined: Apr 20, 2026, 6:53 PM
Posted: May 1, 2026, 8:46 PM

PROCEDURE DIVISION.
MAIN-LOGIC. (when and why is this used)
PERFORM INITIALIZATION (when and why is this used_
PERFORM PROCESS-RECORDS UNTIL WS-EOF = 'Y'
PERFORM TERMINATION (when and why is this used)
STOP RUN.

INITIALIZATION.
OPEN INPUT EMPLOYEE-FILE
OPEN OUTPUT REPORT-FILE
PERFORM READ-EMPLOYEE-RECORD.

PROCESS-RECORDS.
ADD EMP-SALARY TO WS-TOTAL-SALARY
ADD 1 TO WS-COUNTER
WRITE REPORT-RECORD FROM EMPLOYEE-RECORD
PERFORM READ-EMPLOYEE-RECORD.

READ-EMPLOYEE-RECORD.
READ EMPLOYEE-FILE
AT END MOVE 'Y' TO WS-EOF
END-READ.

TERMINATION.
DISPLAY "Total employees: " WS-COUNTER
DISPLAY "Total salary: $" WS-TOTAL-SALARY
CLOSE EMPLOYEE-FILE
CLOSE REPORT-FILE.

You must be signed in to reply to this thread