File is used to store data in form or record. Broadly speaking record are of two type Fixed Length and Variable Length Records.
- Fixed Length : All of the records in an entire file have the same length.
- Variable Length : All of the records in an entire file have the variable length.
Most of the records in files are fixed-length records. That means that all of the records in an entire file have the same length. Occasionally, though, it makes sense to create a file that contains variable-length records.
That means that a file contains records of different sizes. In most cases, the variable-length records are blocked for the same reasons that fixed-length records are blocked.
Block Records | Unblock Records |
When records are blocked, two or more records are stored in each sector. Since this makes better use of disk storage, most files contain blocked records. | When records are unblocked, only one record is stored in each sector. |
With blocked records, the disk drive reads or writes a block of records at a time. This means that there’s only one rotational delay for each block of records, and that can improve the efficiency of a program that works with disk files. | With Unblock records, the disk drive reads or write single record at a time. |
The blocking factor is the number of records that are stored in a block. To get the most from blocking, you use a blocking factor that wastes as little disk space as possible. If a block of records spans two or more sectors, all of the sectors are read or written at once. | NA |
The COBOL programmer usually doesn’t have to worry about blocking because this is handled automatically by the compiler and operating system. As a result, you write the program as if it were working with unblocked records. |
No comments:
Post a Comment