Monday 28 July 2014

COBOL File I/O Mode.

A sequential file can be opened in one of the following four modes. Before reading record from file we need to open file is appropriate mode as per requirment. Refer Below figure. 


  • INPUT MODE : A file can be opened in the INPUT mode only if it is already existing. Such a file becomes an input file from which records can be read sequentially.
  • OUTPUT MODE : When a file is to be created for the first time, it must be opened in t he OUTPUT mode. Note that, opening an existing file in the OUTPUT will result in the loss of all the data.
  • EXTENDED MODE : The EXTEND mode also opens a file for writing, but the file pointer is positioned after the end of the last record. Thus any records written will get appended to the file.
  • I-O MODE : A file is opened in the I-O mode when it needs to be updated. This mode provides both reading and rewriting of records.

Note : Moreover in large mainframe application client always prefer to have separate application module to open and close all required file. Basically all required files were open in appropriate mode as soon as batch cycle trigger. 



Created with Artisteer

No comments:

Post a Comment

New In-feed ads