Вы находитесь на странице: 1из 12

OPERATIONS ON FILES

BY
ANU JOHN
Operations on files are two
types
 Retrieval
operations
 Update operations
Retrieval operation

 Do not change any data in the file


 Locate certain records
 Field values can be examined and
processed
Update operations
 Change the file by insertion or deletion
of records or by modification of field
values
 We select one or more records for
retrieval,deletion,or modification based on
selection condition
 Selection condition specifies criteria that the
desired records must satisfy.
 Search operations on files are based on
simple selection conditions
 Complex condition must be decomposed to
extract a simple condition
 When several file records satisfy a
search condition ,only the first record-
with respect to some physical
sequence- is located.
 The most recently located record of the
file is current record.
Representative operations
 Open:
-Prepares the files for reading or writing
-Allocate appropriate buffer
 Reset:
-Set the file pointer of an open file to
the beginning of the file
 Find(locate):
- searches for the first record
- transfer the block that containing
that record into main memory buffer
- file pointer points to the record in the
buffer so it become the current
 Read (get)
-copies the current record from
the buffer to the program
variable.

FindNext
-search for the next record in the file
- transfer the block containing that
record into main memory buffer
- that record become the current
record
 Delete
-delete the current record and updates the
file
 Modify
-Modify some field values for the current
record & update the files
 Insert
- find the block where the record is to be
inserted and insert the record.
Close:
complete the file access by releasing the
buffer

 All the above operations(except open,close)


are called record_at_a_time operations
 FindAll:locates all the records in the file
that satisfies search condition.
 Findorderd:retrieves all the records in
the file in a specific order.
 Reorganize:start the reorganization
process.
 These operations are called set_ at_
a_time operation .
 Fileorganization
Organization of data of files into
record,block,and access structure
 Access method
Provide group of operation that
can be applied to the file

In many organization we can’t apply all


operations so we must taken into
account the expected importance and
mix of retrieval and update operation

Вам также может понравиться