Relative files, COBOL Programming


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
The LENDER Bank offers mortgages on homes valued up to $500,000. The required down payment is calculated as follows: 4% of the first $60,000 borrowed 8% of the next $30,000 borro

RESERVE clause: This clause indicates the number of buffers to be used for the file. Integer-1 specifies this number. ORGANIZATION/ACCESS clause: These two clause

Can u please let me know how can i use SSA''s in IMS while fetching segments. Thanks, Rajesh

COBOL Words: The COBOL word can be formed by using the characters as shown below: 0-9 A-Z (a-z) - (hyphen) The rules below should be hold in forming the COBOL words.

DECLARATIVE and FILE STATUS Clause: The input-output exception condition in the situation of a direct access files can be handled by a declarative procedure in a manner simila

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

MULTIPLY VERB:   The Multiply Verb causes one or more multiplicands to be multiplied by the multiplier and to store the products. The form of the MULTIPLY verb is as shown be

PROGRAM FOR INDEXED SEQUENTIAL FILE CREATION: We have to write a program to create an Indexed Sequential File in a dynamic mode for Student particulars. Suppose just 3 fields:

Common form of the READ statements: Format 1 is the common form of the READ statements. Format 2 is used when the access mode is either random or dynamic. For illustration,

Program for Sequential File Creation & Rewriting  We have to write a program to create a Length file with just two fields: l (Length) and l-c (Length-Code). Add a few records.