SINGLE CONTROL-BREAK ALGORITHM

 

PROBLEM:  how many seniors, how many juniors, etc. and how many total students

 

record length = 5

DATA:  04CIS04CIS04FIN04MIS04MIS03MIS03MIS03YOG02GYM

 

cbvalue = control break input field value

temp = temporary variable for holding previous cbvalue

 

****************************************************************************

 

set number of students to 0

set total number of students to 0

read one record from input file

     if not at end (either IF or NOT AT END of read)

             move cbvalue to temp

loop until end of file

            add 1 to total number of students

            if temp not equal to cbvalue

                        output control break information – write number of students

                        set number of students to 0

                        move cbvalue to temp

            work with current input record information

                        add 1 to number of students

read one record from input file

end loop

output last control break information

output other total information

etc…