File Declaration Interview Questions
How to declare the files in COBOL?
A file should be declared with all its characteristics for processing in the application program. If it is not declared, the program is unaware of the file. Programs use these things to define the file's characteristics, such as the file type, length, recording mode, etc., and start processing the file.
In which COBOL section do you assign your file?
SELECT clause is used to map the logical-file-name with the physical file external to the program.
Where to define the file structure in COBOL program?
The logical file structure definition should be in the FILE SECTION of DATA DIVISION.
How can we reference or make COBOL program realise that about the following file formats?
- Fixed Block File - Declaration of fixed block file is -
ORGANIZATION IS SEQUENTIAL RECORDING MODE IS F BLOCK CONTAINS 0
- Fixed Unblock File - Declaration of fixed unblock file is -
ORGANIZATION IS SEQUENTIAL RECORDING MODE IS F
- Variable Block File - Declaration of variable block file is -
ORGANIZATION IS SEQUENTIAL RECORDING MODE IS V BLOCK CONTAINS 0
- Variable Unblock File - Declaration of fixed unblock file is -
ORGANIZATION IS SEQUENTIAL RECORDING MODE IS V
- Printer File - Declaration of printer file is -
ORGANIZATION IS SEQUENTIAL RECORDING MODE IS F BLOCK CONTAINS 0
Frequently Asked Questions -
Where to define file in COBOL?
Which COBOL section do you define your file structure?