• We need your support!

    We are currently struggling to cover the operational costs of Xtremepapers, as a result we might have to shut this website down. Please donate if we have helped you and help make a difference in other students' lives!
    Click here to Donate Now (View Announcement)

Computing 9691 AS Level Discussion - Explanations needed

Messages
25
Reaction score
37
Points
23
Hey guys.
So there wasn't any open thread on computing problems, so I had to post one. Could someone explain sequential, indexed sequential and random accessing to me?
For these organisations
please explain
-how files can be accessed, and
-how adding new records, or deleting existing records works in them.
Any help will be appreciated.
Thankyousomuch ^_^

Also, could this be an open discussion thread for computing problems? :)
If any of you have the subject in A levels, that is.
Thanks.
 
Messages
66
Reaction score
20
Points
18
I found this notes on the internet and I think this might help you.

What is serial (or sequential) access?


This is the method used by a computer program to access a record in a file where each and every record is checked from the beginning of the file until a match is found.



What is direct (or random) access?

This is the method used by a computer program to access a record in a file directly without going through each and every record starting from the beginning of the file. The computer program uses the mechanism called hash keys for direct access.



What is a serial file and how it is created?

This is a file where records are written to it in the order that they are received. The records in a serial file may not be in order with respect to a key field.



How a program access records in a serial file?

The program accesses the records sequentially. A program cannot access records in a serial file directly.



What is a sequential file?

This is a file where records are organized in ascending or descending order with respect to the primary key.



How a program creates a sequential file?

The program writes a new record to the end of the file and sorts the file each time a new record is added.



How a program access records in a sequential file?

The program accesses the records sequentially. A program cannot access records in a sequential file directly.



What is an indexed sequential file?

1. This is a file where records are organized in the ascending or descending order with respect to

the primary key and where the records are divided into pages of equal size.


2. The data pages of the index sequential file are associated with an index file. Index is a pointer

which contains the absolute memory or disk address of the first record of a data page.


3. Index file contains two fields: Primary key and the index. All the records in one data page have

the same index (which is the memory address of the data page where that record is contained).


4. A computer program can access records in an indexed sequential file both sequentially and

directly.



How a program creates an index sequential file?

1. The program writes the new record to the end of the file, divides the records into equal sized

pages and sorts the records within each page. This process happens each time a new record is

added to the indexed sequential file.


2. Then the program creates the index file which contains the primary keys and the corresponding

index of each primary key (index is the pointer which contains the absolute memory or disk

address of the first record of a data page).


3. When the number of records containing in an indexed sequential file increases, the number of

pages in the file and therefore the number of indexes also increase. This makes it necessary to

divide the index also into pages. An index which itself is divided into pages is called a multi-

level index.


How a program access records in an indexed sequential file?

1. When the user enters the primary key of the record which he wants to access, the program uses

the index file to find the index of that primary key. When the above sample file is considered

the program uses the following algorithm to find the index.

IF primary_key > LW00001 and primary_key < LW00100

Index = 200001

IF primary_key > LW00001 and primary_key < LW00100

Index = 200101

IF primary_key > LW00001 and primary_key < LW00100

Index = 200201

.

.

.

ENDIF


2. Since the index is the pointer containing the memory address of the page, it helps the computer

program to access the page directly. Within the page the program accesses the record by using

sequential access method.



What is a random access file?

1. This is a file where records are written to the absolute memory or disk addresses pointed to by

a set of hash keys stored in a hash table.


2. A computer program can access records in a random file only directly but not sequentially.



How a program creates a random access file?

1. When a new record is to be written to the random access file, the computer program creates the

corresponding hash key of the record by applying a hash function (or a hashing algorithm) on

the primary key of the record. When deriving the hash function to be applied, the program

takes into account the estimated number of records in the random access file.


2. The program then stores the record at the memory or disk address pointed to by the hash key.


3. The program stores the primary keys and the corresponding hash keys in the hash table

associated with the random access file.


4. The hash keys are written to the hash table at sequential locations until a collision occurs.


5. A collision occurs when the computer program finds two hash keys with the same value

competing for the same location in the hash table.


6. Even though the hash keys are stored in the sequential order in the hash table, the records in

the random access file may not be in the sequential order.



How a program access records in a random access file?

1. The program which searches a record in a random access file calculates the hash key of the

record being searched by applying the hash function on the record’s primary key (which is

entered to the program by the user).


2. The computer program then accesses the absolute memory or disk address pointed to by the

hash key. This is the location where the search record is stored.


3. If the same hash key occurs more than once in the hash table (this happens if there had been

collisions while writing the hash keys to the hash table), the computer program which searches

the record accesses the primary key pointed to by each occurrence of that hash key to find the

matching one.


4. A computer program can access records in a random access file only directly but not

sequentially
 
Messages
553
Reaction score
1,080
Points
73
Hey guys.
So there wasn't any open thread on computing problems, so I had to post one. Could someone explain sequential, indexed sequential and random accessing to me?
For these organisations
please explain
-how files can be accessed, and
-how adding new records, or deleting existing records works in them.
Any help will be appreciated.
Thankyousomuch ^_^

Also, could this be an open discussion thread for computing problems? :)
If any of you have the subject in A levels, that is.
Thanks.
Good idea. Except i was gonna make a similar thread, but to see you already have one :p
 
Top