1 R. Ching, Ph.D. MIS Dept. California State University, Sacramento Week 14 Reading a File Loops
2 R. Ching, Ph.D. MIS Dept. California State University, Sacramento Files File - collection of records John Smith Richard Roe Logical records - represent entities (persons, places, objects, things, etc.) Fields - describe properties of the entities
3 R. Ching, Ph.D. MIS Dept. California State University, Sacramento Basic Concepts DASD (direct access storage device) Track Cylinder (vertical alignment of tracks) Magnetic disks Performance: Seek timeSeek time Rotational delayRotational delay Transfer timeTransfer time
4 R. Ching, Ph.D. MIS Dept. California State University, Sacramento Access Data Tracks Locating the right track Locating the beginning sector Transfer time: Transferring data from the disk to memory Read/write Head Seek time Rotational delay
5 R. Ching, Ph.D. MIS Dept. California State University, Sacramento Basic Concepts DASD (direct access storage device) Tracks Physical records (blocks, pages) Logical records Block overhead
6 R. Ching, Ph.D. MIS Dept. California State University, Sacramento File Organization and Access Methods Progression MagnetictapeMagnetictape Heap (sequential) filesHeap (sequential) files HashedHashed –Hashed files Sorted*Sorted* –Indexed sequential –B+ trees (e.g., VSAM files) DSAD Sequential access method Secondary storage devices Secondary Indexed access methods Hash methods *Applies to accessing records, not just storing them
7 R. Ching, Ph.D. MIS Dept. California State University, Sacramento File Organization and Access Methods File Organization The physical arrangement of data in a file into records and pages on secondary storageFile Organization The physical arrangement of data in a file into records and pages on secondary storage –Types: Heap (unordered)-sequentialHeap (unordered)-sequential Ordered (ordered by value)Ordered (ordered by value) HashHash Access method The steps involved in storing and retrieving records from a fileAccess method The steps involved in storing and retrieving records from a file
8 R. Ching, Ph.D. MIS Dept. California State University, Sacramento Heap or Sequential Files Queue Records are accessed in the same sequence they were placed into the file (first in, first out).
9 R. Ching, Ph.D. MIS Dept. California State University, Sacramento
10 R. Ching, Ph.D. MIS Dept. California State University, Sacramento Insert at the very top Define variables Define file stream Open file For-next Loop
11 R. Ching, Ph.D. MIS Dept. California State University, Sacramento While loop Copy-and-paste from For-next loop End of file