Monday, November 21, 2011

Defining the file in FILE SECTION



FD FILENAME
RECORDING MODE IS V/VB/F/FB
RECORD CONTAINS M CHARACTERS (TO N CHARACTERS)
BLOCK CONTAINS X CHARACTERS/RECORDS (TO Y CHARACTERS/RECORDS)
LABEL RECORDS ARE OMITTED/STANDARD
DATA RECORD IS FILE-RECORD.
01 FILE-RECORD PIC X(nnn).

FD-RECORD CONTAINS                          
It specifies the length of the record in terms of bytes. (It will be RECORD contains m to n CHARACTERS for variable format files)

FD-BLOCK CONTAINS

It specifies the physical record size. It can be mentioned as number of logical records OR number of characters, that is multiple of logical record length. It is suggested to code BLOCK CONTAINS 0 RECORDS so that system will decide the optimum size for the file based on the device used for storing the file. BLOCK CONTAINS clause is treated as comments for VSAM files.

Advantage of Blocking:                
1.I-O time is reduced as n numbers of records are read into main memory buffer during an I-O.    
2.Inter record gap is removed and the gap exist only between blocks. So memory wastage due to IRG is avoided.  

FD-RECORDING MODE IS              
It can be F (FIXED) V(VARIABLE) FB(FIXED BLOCK) VB(VARIABLE BLOCKED)
Variable record file identification:   
If there is no recording mode/record contains clause, it is still possible to identify variable length records. If there is an OCCURS depending on clause or there are multiple 01 levels and every 01 level is of different size, then the file would be of variable length. Multiple 01 level in File section is an example for implicit redefinition.

FD-LABEL RECORDS Clause

As a general rule, LABEL RECORDS are STANDARD is coded for Disk and Tape files, LABEL RECORDS ARE OMITTED is coded for printer files. In COBOL74, this clause is a mandatory clause whereas COBOL85 made this as optional.

FD-DATA RECORD IS Clause

          It is used to name the data record(s) of the file. More than one record can be coded here. 

No comments:

Post a Comment