Download Students.Dat and
save it to the \WorkArea directory on drive D:
|
|
|
|
Student Id |
|
|
|
Student Name |
| ||
Surname |
|
|
|
Initials |
|
|
|
DateOfBirth |
| ||
Year |
|
|
|
Month |
|
|
|
Day |
|
|
|
Course Code |
|
|
|
Grant |
|
|
|
Gender |
|
|
|
You may think that a solution using tables would be the answer here. That is, read each record, find its CourseCode and add 1 to the appropriate place in a CourseCode table (where the elements are in CourseCode order). When all the records have been processed display the results by going through the table element by element.
The problem with this solution is that new courses are added quite frequently. If we adopted the table approach we would have to change the program each time a new course is added.
So the solution you are going to adopt in this exercise is to create a new file with the records sorted on ascending CourseCode by using the SORT verb to sort the Students File. To make the SORT as efficient as possible (by reducing the amount of data that needs to be processed) records of the sorted file should only contain the fields that are needed for this program. An Input Procedure should be used to create the appropriate Sort Records.
When the sorted file has been produced it is a simple matter to process it to
calculate the required totals
|
|
|
|
Course Code |
|
|
|
Gender |
|
|
|
![]() |
![]() |
![]() |
|