Writing records to a Sequential File
ACCEPT, DISPLAY, WRITE, PERFORM..UNTIL
Using Seqread.Cbl as a starting point, write a program called SeqWrite.Cbl
to accept student records from the user and write them to a file (MyStudents.Dat).
The program should keep accepting records from the user until spaces are
entered instead of a record (i.e.the Enter key is pressed without having
entered any data). No error checking on the data entered is required.
The program should prompt the user for each record and should provide
a template to make it more easy to enter the data correctly (see Example
The student records accepted from the user must be written to a file.
Each record will have the following description.
Please enter the student record using the template below.
Press the Enter key with no data to stop.
Add code to your program to read the file you have just created and
display the records. Display the records as shown in the example
Stud-Id Student Name Gender
9765321 COUGHLAN MS M
9787654 RYAN GT
9734563 POWER RG M
9734562 SMITH WB M
9765341 KENNEDY DS F
When you have written your program and have compiled it and have it working
correctly, you may wish to compare it with this sample
Do not look at the solution until you have finished your own
or at least have made a substantial effort to complete it.
Last updated :March 1997
e-mail : CSISwebeditor@ul.ie