Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 10: File processing

OPEN file: Step 3 of File Handling

  • Once file is allocation and its structure is defined, we are good to use file
  • But before we begin any processing it should be opened and connection is established using OPEN statement
  • FILE STATUS is updated after operation
  • Basic syntax of OPEN statement


  • As stated in syntax, file can be opened in either of four modes:- INPUT, OUTPUT, EXTEND or I-O. ”file-name” is logical file name
    OPEN mode Description
    INPUT It allows to open file only for READ purpose, no other operations are allowed. However, START operation is allowed to put READ pointer at required position
    OUTPUT It allows to insert record in file using WRITE operation
    EXTEND It allows to append (insert to end) records in a sequential file. EXTEND mode cannot be used for RELATIVE and INDEXED file organization
    I-O It allows us to perform READ, WRITE or REWRITE operations depending on file organization
  • Allowable operations for different file organization:-

© copyright mainframebug.com
Privacy Policy