COBOL FILES:

COBOL Perform Varying COBOL File Processing Cycle

Advertisements


FILE is a logical representation data stored in memory location.

FILEs used to store the data permanently in a structured way.

FILE contains RECORDs which are logically dividing the FILE data.

Each RECORD contains the FIELDs which is typically data items or identifier in the RECORD layout.

FILEs are usually stored in DISKS/TAPES in mainframe environment.

Maximum 255 files used in COBOL program.

ORGANIZATION Clause is used to define a file.


Hierarchy of file:




In the hierarchical manner, file can be defined as a set of records which are stored as a instances/ occurrences.

Records can be defined as a combination of fields which are defined a sequence.

Fields can be defined as a collection of information which needs to be stored.


Types of Files:


FILEs divided into three types based on how the data stored and how the data accessed from memory.

The three types are


  • Sequential files (data is entered in sequential order)
  • Indexed files (data is entered based on key sequential order)
  • Relative files ( data is entered based on RRN - Relative Record Number)

Sequential Files:


  1. Sequential file records are read from top to bottom but bottom to top is not possible.
  2. Specific record reading is not possible in sequential files.
  3. Sequential files are also called as flat files, QSAM files, non-VSAM files.

Indexed Files:


  1. Retrieving of data is faster in indexed files.
  2. Random accessing of data is done in indexed files based on key ( ex: bank a/c no).
  3. Data accessing is faster in indexed files.
  4. Data arranged in sorted order based on key.
  5. Duplicate records are not allowed in indexed files.
  6. Specific record reading is possible in indexed files.
  7. Indexed file are cannot be store on tape. They are store in disk.
  8. Key columns are cannot be updated since key is identifier.
  9. Specific record deletion and reading is possible in indexed files.
  10. Indexed files are also called as VSAM files, KSDS files.

Relative Files:


  1. Based on relative record number (RRN) data can be stored in relative files.
  2. RRN is not used defined. That is system defined key.
  3. Retrieving of data is very difficult in relative files.
  4. Relative files are also called as RRDS (relative record data set files).

Disadvantages of relative files:

  1. Retrieving of RRN is practically impossible.
  2. Whenever we delete any data in a relative files unused storage space is created. Memory storage space is wasted.

COBOL Perform Varying COBOL File Processing Cycle

Advertisements