File Organization Interview Questions
What is the file organization?
File organization is the method used to store and arrange data records within a file. It specifies how information is physically stored in the memory and impacts how efficiently data can be accessed and managed.
What are the file organizations supported by COBOL?
COBOL primarily supports three types of file organizations -
- Sequential File Organization
- Indexed File Organization
- Relative File Organization
How will you define a sequential file in COBOL?
Sequential file organization applies to the sequential files (PS - Physical sequential file) that use the QSAM access method. Example - Declaring a sequential file in program.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT empfile ASSIGN TO input01
ORGANIZATION IS SEQUENTIAL
How will you define an indexed file in COBOL?
Indexed file organization applies to the KSDS file that uses the Virtual storage access method (VSAM). Example - Declaring indexed file in program with key emp-no and alternate key emp-dept.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT empfile ASSIGN TO input01
ORGANIZATION IS INDEXED
RECORD KEY IS emp-no
ALTERNATE KEY IS emp-dept
How will you define relative file in COBOL?
Relative file organization applies to the RRDS file that uses the Virtual storage access method (VSAM). Example - Declaring Relative file in program with key emp-rrn.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT empfile ASSIGN TO input01
ORGANIZATION IS RELATIVE
RELATIVE KEY IS emp-rrn
Frequently Asked Questions -
What are the different File organisations in COBOL?
What are the different types of file organizations available?
Give the importance of Sequential, Index, relative files in real time?