Monday, November 21, 2011

Steps in FILE HANDLING


A data file is collection of relevant records and a record is collection of relevant fields. The file handling in COBOL program involves five steps.
         

Steps in file-handing


1.Allocation: The files used in the program should be declared in FILE-CONTROL paragraph of environment division. The mapping with JCL DDNAME is done here. The file is allocated to your program by this statement. 

2.Definition. The layout of the file and its attributes are defined in the FILE SECTION of DATA DIVISION.

3.Open: Dataset is connected/readied to your program using OPEN statement. The mode of OPEN decides the operation allowed and the initial pointer in the dataset. For example, EXTEND mode allows only write access and the pointer is kept on the end of file to append.

4.Process: Process the file as per requirement, using the I-O statements
provided by COBOL. (READ, WRITE, REWRITE and DELETE)

5. Close: After the processing, close the file to disconnect it from the program.

No comments:

Post a Comment