Close a database file

When your program completes processing a database file member, it should close the file. Closing a database file disconnects your program from the file.

The close operation releases all record locks and all file member locks, forces all changes made through the open data path (ODP) to auxiliary storage, then destroys the ODP. (When a shared file is closed but the ODP remains open, the functions differ)

To close a database file in a program, use one of the following methods:

If a job ends normally (for example, a user signs off) and all the files associated with that job were not closed, the system automatically closes all the remaining open files associated with that job, forces all changes to auxiliary storage, and releases all record locks for those files. If a job ends abnormally, the system also closes all files associated with that job, releases all record locks for those files, and forces all changes to auxiliary storage.

When a process is trying to lock a file that is held by another process, the Close database file exit program is called. This exit is called in the process that is holding the lock.

Related concepts
Share database files in the same job or activation group
Control language (CL)
ILE Concepts PDF
Related reference
Close File (CLOF) command
Reclaim Resources (RCLRSC) command