READ, PERFORM ..
UNTIL, IF,
COMPUTE, DISPLAY
Introduction
The program SeqRead.cbl reads a sequential file and displays the StudentId, StudentName and the CourseCode of each record in the file on the screen. In this exercise you will re-write this program so that it displays a count of the number of male students and the number of female students in the file Students.dat.
Download the SeqRead.cbl program and save it to the WorkArea directory the D: drive.
Download the data file Students.dat and save it to the same place.
Load SeqRead.cbl into the GnuCOBOL environment.
Amending SeqRead
Change the program SeqRead2.cbl to produce a program which counts the number of male students and the number of female students in the file Students.dat and then displays these counts on the computer screen.
The student record consists of the following items;
| Field | Type | Length | Value |
|---|---|---|---|
| Student Id | 9 | 7 | 0-9999999 |
| Student Name | . | . | Group |
| Surname | X | 8 | - |
| Initials | X | 2 | - |
| DateOfBirth | . | . | Group |
| Year | 9 | 4 | 0000-9999 |
| Month | 9 | 2 | 01-12 |
| Day | 9 | 2 | 01-31 |
| Course Code | X | 4 | - |
| Gender | X | 1 | M/F |
STUDENT NUMBERS :- SUMMARY REPORT Number of Males = 20 Number of Females = 15