Tuesday, 12 August 2014

COBOL Record Description.

A record is a unit of information consisting of related data items within a file. Most often a file consists of records that all have the same length and format. 
A Record Description are entries used to describe record within a file and with WORKING-STORAGE. 

The record description entries are made in the FILE SECTION of the DATA DIVISION under the FD paragraph.
Format : 1

Format : 2

RECORD CONTAINS clause : The RECORD CONTAINS clause specifies the size of the logical records. This clause cannot be used for LINE SEQUENTIAL files.
BLOCK CONTAINS clause : The BLOCK CONTAINS clause specifies the size of the physical records. If the records in the file are not blocked, the BLOCK CONTAINS clause can be omitted. When it is omitted, the compiler assumes that records are not blocked. 
Even if each physical record contains only one complete logical record, coding BLOCK CONTAINS 1 RECORD would result in fixed blocked records. The BLOCK CONTAINS clause can be omitted when the associated FILE CONTROL entry specifies a VSAM file, since the concept of blocking has no meaning for VSAM files.
DATA RECORD clause : The DATA RECORD clause specifies the record names defined for the file. It is used only to provide better documentation.
Example : 

No comments:

Post a Comment