ACTIVITY #2 File organization and input-output devices Depending - TopicsExpress



          

ACTIVITY #2 File organization and input-output devices Depending on the input-output devices, your file organization can be sequential, line sequential, indexed, or relative. Decide on the file types and devices to be used when you design your program. You have the following choices of file organization: Sequential file organization The chronological order in which records are entered when a file is created establishes the arrangement of the records. Each record except the first has a unique predecessor record, and each record except the last has a unique successor record. Once established, these relationships do not change. The access (record transmission) mode allowed for sequential files is sequential only. Line-sequential file organization Line-sequential files are sequential files that reside on the hierarchical file system (HFS) and that contain only characters as data. Each record ends with a new-line character. The only access (record transmission) mode allowed for line-sequential files is sequential. Indexed file organization Each record in the file contains a special field whose contents form the record key. The position of the key is the same in each record. The index component of the file establishes the logical arrangement of the file, an ordering by record key. The actual physical arrangement of the records in the file is not significant to your COBOL program. An indexed file can also use alternate indexes in addition to the record key. These keys let you access the file using a different logical ordering of the records. The access (record transmission) modes allowed for indexed files are sequential, random, or dynamic. When you read or write indexed files sequentially, the sequence is that of the key values. Relative file organization Records in the file are identified by their location relative to the beginning of the file. The first record in the file has a relative record number of 1, the tenth record has a relative record number of 10, and so on. The access (record transmission) modes allowed for relative files are sequential, random, or dynamic. When relative files are read or written sequentially, the sequence is that of the relative record number. With IBM Enterprise COBOL for z/OS, requests to the operating system for the storage and retrieval of records from input-output devices are handled by the two access methods QSAM and VSAM, and the UNIX file system. The device type upon which you elect to store your data could affect the choices of file organization available to you. Direct-access storage devices provide greater flexibility in the file organization options. Sequential-only devices limit organization options but have other characteristics, such as the portability of tapes, that might be useful. Sequential-only devices Terminals, printers, card readers, and punches are called unit-record devices because they process one line at a time. Therefore, you must also process records one at a time sequentially in your program when it reads from or writes to unit-record devices. On tape, records are ordered sequentially, so your program must process them sequentially. Use QSAM physical sequential files when processing tape files. The records on tape can be fixed length or variable length. The rate of data transfer is faster than it is for cards. Direct-access storage devices Direct-access storage devices hold many records. The record arrangement of files stored on these devices determines the ways that your program can process the data. When using direct-access devices, you have greater flexibility within your program, because your can use several types of file organization: • Sequential (VSAM or QSAM) • Line sequential (UNIX) • Indexed (VSAM) • Relative (VSAM) Basic file organization techniques Given that a file consists, generally speaking, of a collection of records, a key element in file management is the way in which the records themselves are organized inside the file, since this heavily affects system performances ad far as record finding and access. Note carefully that by ``organization we refer here to the logical arrangement of the records in the file (their ordering or, more generally, the presence of ``closeness relations between them based on their content), and not instead to the physical layout of the file as stored on a storage media, To prevent confusion, the latter is referred to by the expression ``record blocking, and will be treated later on. Choosing a file organization is a design decision, hence it must be done having in mind the achievement of good performance with respect to the most likely usage of the file. The criteria usually considered important are: 1. Fast access to single record or collection of related recors. 2. Easy record adding/update/removal, without disrupting (1). 3. Storage efficiency. 4. Redundance as a warranty against data corruption. Needless to say, these requirements are in contrast with each other for all but the most trivial situations, and its the designer job to find a good compromise among them, yielding and adequate solution to the problem at hand. For example, easiness of adding/etc. is not an issue when defining the data organization of a CD-ROM product, whereas fast access is, given the huge amount of data that this media can store. However, as it will become apparent shortly, fast access techniques are based on the use of additional information about the records, which in turn competes with the high volumes of data to be stored. Logical data organization is indeed the subject of whole shelves of books, in the ``Database section of your library. Here well briefly address some of the simpler used techniques, mainly because of their relevance to data management from the lower-level (with respect to a databases) point of view of an OS. Five organization models will be considered: • Pile. • Sequential. • Indexed-sequential. • Indexed. • Hashed.
Posted on: Mon, 02 Dec 2013 09:07:55 +0000

Trending Topics



Recently Viewed Topics




© 2015