The Student Room Group
Reply 1
For sequential files, with an example of User IDs, where every user ID is unique, and the record for certain user IDs need to be updated (those in the Transaction file):

Open Transaction File for reading
Open Old UserIDs File for reading
Open New UserIDs file for writing
While not end of Transaction file do
Read Next Transaction File Record
Read Next Old UserIDs File record
If Transaction File Record.UserID <> Old UserIDs File Record.UserID
Then Write Old UserIDs File Record to New UserIDs File
EndIf
EndWhile
Write remainder of Old UserIDs file to New UserIDs file
Close all files
Archive Old Users File //(If it asks you to)
Rename New UserIDs File as CurrentUserIDs File


That was taken from AQA CPT2 June 2003 and edited a little so that I could understand it better and probably you too.

Serial files are simpler:

Open File for writing
Append Record to end of file
Close file writing


Obviously there may be a data source for where the record comes from in the first place. However I don't think they'll be asking you to say how to do a serial file I think they just ask about sequential.

For reading or searching for records in serial or sequential files, open of the file, start from the beginning, repeat until a match found a process of reading and testing for a match, or if the file is indexed, when the key of the record you're on is more than the key of the record you want to find, end the process, because it means the record doesn't exist.

Hope I've been of some help, good luck in the exam tomorrow!
Reply 2
good luck in ur exam 2 moro.
Reply 3
JazzBassRob
Hi, last thing I need for AQA CPT2 tommorrow if anyone can help!

I want to learn the pseudocode for updateing/reading serial, sequential and direct files, but i can't find anything on the internet, does anyone know where I can find them?

Thanks, any help is greatly appreciated!!!!

oh and good luck everyone :wink:


Serial - create a new tape copying over all the records until the one needs to be deleted, leaving the deleted one off the tap, then copying over all the rest of the records

Sequential - copy the file, then copy all over the records until the one that can be written in its proper place, then copy all over the rest of the records.

According to my textbook there is no updating/reading direct access files.
Reply 4
Thanks for that everyone thats a great help! Just got to learn them for this afternoon now... :cool:
Reply 5
JazzBassRob
Thanks for that everyone thats a great help! Just got to learn them for this afternoon now... :cool:


You're welcome. It will be easy to learn, you got about 4 hours to learn that, plenty of time. :smile:

Latest

Trending

Trending