Monday, 28 July 2014

COBOL Relative Organization.

The records in a file with relative file organization (a relative file) can also be accessed both sequentially and randomly. The trouble is that not many files can be easily adapted to this type of organization.

In relative ORGANIZATION, a file is thought of as a string of record areas, each of which contains a single record. Each record area is identified by a relative record number, the access method stores and retrieves a record, based on its relative record number. 

For example, the 1st record buffer is addressed by relative record number 1, the 2nd is addressed by relative record number 2 and so on. 

The physical sequence in which the records were placed in the file has no bearing on the record area in which they are stored and thus on each record's relative record number. 

Similar to Index sequential ORGANIZATION here also, the records can be accessed both sequentially and randomly. A relative file provides the fastest access to records but has some disadvantages. Even if some of the intermediate records are missing, they occupy space. Hence it is suitable for data which can be converted to some unique record number through some transformation. 

This transformation must result in high degree of packing for the file to be completely filled. Also, problems arise if the transformation is not unique. Another disadvantage of this kind of organisation is that for some hashing function to be effective, some idea of the average number of records that will be present in the file is required. This information may not be available.

Note : Drawback of Relative File.

But what if a master file of 10,000 inventory records has item numbers that range from 100,000 to 2,000,000? How, for example, do you convert those item numbers to relative record numbers that range from 1 through 12,000 (that provides for 2,000 empty record areas)? Although you can try to develop a randomizing routine that does the conversion, it is likely to be impractical. That’s the primary reason why relative files are rarely used.


Created with Artisteer

No comments:

Post a Comment

New In-feed ads