Using Tables


READ, pre-defined Tables, Tables.

Introduction

A program is required which will process the Students File (Students.Dat) and will count the number students born on each month of the year and will display the results to January to December order.

 Download Students.Dat and save it to the WorkArea directory on the drive D:
 

Student File Description

The Students File is a sequential file held in ascending StudentId order.
Each record of the students file contains 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
  Use Edited picture clauses and the zero suppression symbol to produce the output as shown.

 

Suggested Approaches.

The main problem that we face here is that the results must be displayed in MonthName order but the file is held in StudentId order.

A tables based solution is a good idea here.  We can use the month number as a direct index into the month table.
 

Sample Solution

When you have written your program and have compiled it and have it working correctly you may wish to compare it with this sample solution.

WARNING

As always please do not look at the solution until you have finished your own program.   At the very least you should make a substantial effort to complete your own attempt at the program before examining the sample solution.    

 


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 : February 1999
e-mail : CSISwebeditor@ul.ie