Relative files, COBOL Programming

RELATIVE FILES:

The Files that are stored on a direct access storage medium like magnetic disk are frequently known as direct access files. The COBOL supports three different groups for disk files- sequential, relative & the index sequential.

A relative file is a magnetic-disk file organized in such a way that each record is identified by the relative record number. The relative record number identifies the position of the record from the starting of the file. Therefore the relative record number 1identifies the initial record, the relative record number 2 identifies the second record and so on.

A relative file can be access either successively or randomly. When the file is accessed successively the records are available in the increasing order of their relative record numbers. Whenever a file is accessed randomly, the programmer should specify the relative record number.

It may be noted that in the situation of relative organization, the reading and writing can be completed randomly. And hence, when a file is created by writing the record randomly, some of the record position may remain blank. While these positions can be filled in sub successively, the programmer must avoid specifying these empty positions while reading like relative file randomly. When a relative file is read in a sequential manner, then these empty places within it, if any, are ignored.

The handling of relative files needs some special codes in the FILE-CONTROL paragraph as well as in the PRCEDURE DIVISION.

 

Posted Date: 10/17/2012 8:09:15 AM | Location : United States







Related Discussions:- Relative files, Assignment Help, Ask Question on Relative files, Get Answer, Expert's Help, Relative files Discussions

Write discussion on Relative files
Your posts are moderated
Related Questions
PROGRAM FOR ADD CORRESPONDING: We have to write a simple program to demonstrate Add Corresponding.   identification division.   program- id.   environment division.

PROGRAM TO DEMONSTRATE MERGE VERB: The two files for which a record having 2 fields viz. Account Number and Name are already available. Now Merge these two files and create a

VALUE CLAUSE: The value clause defines the preliminary value of the data item. Normally initialization will be completed just before the first statement in the procedure di

Illustration of Search verb: To illustrate the other use of SEARCH verb, assume we wish to search the similar tab to find the number of persons whose deposited amount is more

bal majduri ik kanuni apradh hai is de bavjud bache ,ghra,hotla,road, kam karn lai majbur han bacheya te mapeya nu parhai val prerit karn lai ik bashan teyar kro

Example of Redefines clause: This illustration describes a sales record that may either contain the total amount of sale or the quantity (QTY) and UNIT-PRICE. The aim of such

Column and Field in COBOL program: In COBOL there are 2 types of entries termed as margin A and margin B entries. The Margin A entries start from the column 8, 9, 10 or 11 and

Example of File-control: The assign clause assigns a specific physical peripheral device name to a file. The physical peripheral device are machine-dependent. We use the devic

Example of add verb: (a) ADD A TO B. This illustration represents that the value of A will be added to the value of B and the result will be stored in B.  The alignment of

PROGRAM FOR SIZE ERROR:   We have to write an easy program to elaborate the size error option. Identification division. Program- id. sizeerr. Environment division.