0% found this document useful (0 votes)
37 views

1-File Structure

This document discusses different types of file structures and organizations. It begins with basic concepts of storage media, file types, and search methods. It then covers sequential files and their operations like creation, update, search, and delete. Indexed sequential files are also discussed, specifically their use of primary and secondary keys for update, search, and delete operations. Different file organizations are presented, including sequential, direct access, and indexed sequential access, along with their advantages and disadvantages.

Uploaded by

Frankk velasco
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views

1-File Structure

This document discusses different types of file structures and organizations. It begins with basic concepts of storage media, file types, and search methods. It then covers sequential files and their operations like creation, update, search, and delete. Indexed sequential files are also discussed, specifically their use of primary and secondary keys for update, search, and delete operations. Different file organizations are presented, including sequential, direct access, and indexed sequential access, along with their advantages and disadvantages.

Uploaded by

Frankk velasco
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 17

File Structures

Ph.D. Margarita Gamarra


Uninorte
Topics
 Basic concepts
 Storage media
 File types
 Search methods (Sequential, Direct)
 Sequential files operations
 File creation
 Update, search and delete records
 Indexed sequential files
 Primary key and secondary keys
 Update, search and delete records
 Search records by different keys
Data structure
Previous concepts: what is an algorithm?
Data structure
 A data structure is defined as a particular way of storing and
organizing data in our devices to use the data efficiently and
effectively.
 The main idea behind using data structures is to minimize the
time and space complexities.
 An efficient data structure takes minimum memory space and
requires minimum time to execute the data.
Storage media
 Storage media refers to any device that allows data to be stored permanently
 Mechanical or electronic devices
 Store data= Write data= save a file
 Recover data = read data= open a file
 Each device is limited by the maximum amount of data that can be stored on it.

https://docs.oracle.com/cd/E19253-01/819-6957/chp-typeopexpr-2/index.html
About memory

Tomada de GeeksforGeeksDifference between Primary and Secondary Memory - GeeksforGeeks


About memory
File types

Imagen tomada de https://www.geeknetic.es/Guia/91/Los-archivos-tipos-extensiones-y-programas-para-su-uso.html


File organization
 File organization ensures that records are available for processing. There are three
types of organizing the file:
1. Sequential access file organization

2. Direct access file organization

3. Indexed sequential access file organization


Sequential file organization
• Store and sort in contiguous block within files.
• In sequential access file organization, all records are stored in a
sequential order. The records are arranged in the ascending or
descending order of a key field.
• Sequential file search starts from the beginning of the file and the records
can be added at the end of the file.
• In sequential file, it is not possible to add a record in the middle of the file
without rewriting the file.
Sequential file organization

Advantages Disadvantages
• It is simple to program and easy to • Sequential file is time consuming
design. process.
• Sequential file is best use if storage • It has high data redundancy.
space.
• This approach is used when a large • Random searching is not possible.
number of records must be • After you place a record into a
accessed, such as when calculating
sequential file, you cannot shorten,
a student’s grade or generating a
wage slip. lengthen, or delete the record.
However, you can update
• This strategy is employed in the (REWRITE) a record if the length
creation of reports and statistical
does not change.
calculations.
Direct Access file organization

• Direct access file is also known as random access or relative file


organization.
• In direct access file, all records are stored in direct access storage
device (DASD), such as hard disk. The records are randomly placed
throughout the file.
• The records does not need to be in sequence because they are
updated directly and rewritten back in the same location.
• This file organization is useful for immediate access to large amount
of information. It is used in accessing large databases.
Direct Access file organization

Advantages Disadvantages
• Direct access file helps in online • Direct access file does not provide back
transaction processing system up facility.
(OLTP) like online railway • Implementation of direct-access systems
reservation system. is often difficult because of the complexity
• In direct access file, sorting of the and the high level of programming
records are not required. (software) support that such systems
need. In addition, the cost of developing
• It accesses the desired records and maintaining a direct-access system is
immediately. greater than the expense of a sequential
processing system.
• It updates several files quickly.
• It has less storage space as compared to
• It has better control over record sequential file.
allocation.
Indexed sequential access file
organization
• Indexed sequential access file combines both sequential file and
direct access file organization.
• In indexed sequential access file, records are stored randomly on a
direct access device such as magnetic disk by a primary key.
• The data can be access either sequentially or randomly using the
index. The index is stored in a file and read into memory when the
file is opened.
Indexed sequential access file
organization

Advantages Disadvantages
• In indexed sequential access file, • Indexed sequential access file requires
sequential file and random file access unique keys and periodic reorganization.
is possible. • Indexed sequential access file takes
• It accesses the records very fast if longer time to search the index for the
the index table is properly organized. data access or retrieval.
• The records can be inserted in the • It requires more storage space.
middle of the file.
• It is expensive because it requires special
• It provides quick access for software.
sequential and direct processing.
• It is less efficient in the use of storage
• It reduces the degree of the space as compared to other file
sequential search. organizations.
Indexed sequential access file organization

Imagen tomada de
https://www.researchgate.net/publication/273380260_ADMINISTRACION_DE_ARCHIVOS_Ejemplos_practicos_de_utilizacion_de_archivos_Secuenciales_Indexados_y_directos_utilizando_el_lenguaje_C/figures?
lo=1&utm_source=google&utm_medium=organic
Referencias
 https://www.geeksforgeeks.org/learn-data-structures-and-algorithms-dsa-tutorial/
 https://www.tutorialride.com/data-structures/file-organization-in-data-structure.htm
 https://www.ibm.com/docs/en/cobol-aix/5.1?topic=mode-file-organization-access
 https://byjus.com/gate/sequential-file-organization-in-dbms-notes/

You might also like