Data files ? ? ? ?
Data processing: in main memory Economic problems -> big size data -> stored in external memory Organization (identification, classification, description, representation etc.) internal external: logical / physical transformation (during I/E operations) Concepts file and record organization methods and access types processing operations
Logical level File: external data structure ▪ linear, ordered, homogeneous (meaning and processing) ▪ composed of records (equal or varied length) Record: data structure concerning one entity ▪ inhomogeneous, ordered ▪ composed of fields Physical level File: OS records, actual data: flow of bytes, no inherent meaning Representation: text, binary File and record Text files: CR/LF (13, 10) Binary files: nothing Text files: EOF (27, CTRL-Z) Binary files: nothing
File and record Transfer between external storage and internal memory read / write record level: adequate descriptions and operations Internal record structure fixed structurestruct variable structureunion fixed part + variable part struct + union
Organization methods and access types Organization method Principles and rules protection and retrieval ▪ sequential ▪ relative ▪ indexed ▪ etc. (selective, reversed, linked, multi-indexed …) Access types A way of finding records inside a file ▪ sequential ▪ direct (by relative number / key)
Sequential access
Direct access by relative number
Direct access by key
Detection of end of file Direct influence on design of algorithms By reading (Fortran, Cobol, C) Depicted position IS NOT considered end of file Read-independent (Basic, Pascal/Delphi) Depicted position IS considered end of file
Sequential organization Sequentially organized file same / varied length records records are stored in the order they were added access types: sequential, direct (depending on file support) examples: text file (varied length records), binary data files (same length records)
Relative organization Relative organized file same length records relative key: numerical, domain of values records are stored at the position indicated by the key biunivocal relationship ▪ free spaces, valid records access types: sequential, direct (relative key relative number) examples: binary data files
Indexed organization Indexed file two physical files: index file, data file (sequential) same length records alphanumerical keys records are stored in the data file in the order they were added Access types: sequential, direct (key)
Processing operations File level gain access (open) end acces (close) File must be closed delete rename etc. Record level File must be open populate add record(s) retrieve record(s) modify record(s) delete record(s) Basic operations read / write with / without conversion Homework: subchapters 2.1,2.2,2.3, 2.4
Spor la înv ă ţat!