AUTOMATIC CLOSING OF FILES  - IBM Mainframe

If you neglect to close a file (QSAM or VSAM) in your application, the file is automatically closed for you under the following conditions:

  • At the termination of the run unit (STOP RUN, or GOBACK from the main program) all open files defined in any VS COBOL II program within the run unit are closed, both QSAM and VSAM.                                     
  • At abnormal termination of the run unit (when the STAE run-time option is specified), all open files defined in any VS COBOL II program within the run unit are closed, both QSAM and VSAM.
  • When CANCEL is used for a VS COBOL II subprogram, any open non-external files defined in that program are closed.
  • When a VS COBOL II subprogram with the INITIAL attribute returns control, any open non-external files defined in that program are closed.

File status codes are set when these implicit CLOSE operations are performed, but EXCEPTION/ERROR declaratives are not invoked. Also, LABEL declaratives are not invoked when implicit CLOSE operations are performed.


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

IBM Mainframe Topics