Counting records in a sequential file


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 NetExpress 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
2
00-99
Month
9
2
01-12
Day
9
2
01-31
Course Code
X
4
-
Grant
9
4
0000-9999
Gender
X
1
M/F
 
 



Back to COBOL Exercises page To COBOL Exercises Please fill out our evaluation form Evaluation Form Search the CSIS Web Site Search CSIS Web Site
Selectable Site Contents


Last updated : March 1998
e-mail : CSISwebeditor@ul.ie