Deallocating External Files

The method that you use to deallocate a file depends on which method you used to allocate it:
  • If you used the FILENAME statement or FILENAME function to allocate the file, include the CLEAR argument to deallocate it:
    filename books clear;
    Note: The CLEAR argument is optional. Specifying FILENAME fileref; has the same effect.
  • If you used the JCL DD statement to allocate the file, then the file is automatically deallocated when the job step ends. (There is no way to deallocate the file before the job step ends.)
  • If you used the TSO ALLOCATE command to allocate the file, then use the TSO FREE command:
    free fi(books)