Deallocating resources

Deallocation releases resources allocated to your program. You can dynamically deallocate resources that were allocated either dynamically or through JCL, unless the data set is:
  • Open
  • A member of an open concatenated group
  • A private catalog.

In any of these cases, the data set is not deallocated.

Data sets are unallocated:
  • When you explicitly deallocate them
  • When they are closed if FREE=CLOSE is specified
  • At the end of the job step if not deallocated earlier
Note: A data set is not DEQed until it is unallocated by the last step whose JCL references it
When a data set is unallocated:
  • You can use the ddname in subsequent dynamic allocation requests.
  • The system processes the data set disposition.
  • The system frees the unit to which the data set was allocated if it is not being used for any other DD within the step.
  • The system releases the volumes on which the data set was allocated if it is not being used for any other DD within the step.
  • The data set is DEQed and other jobs can use the data set, except when the:
    • System has deleted it as part of disposition processing (the data set will no longer exits and therefore cannot be referenced by any other jobs).
    • Data set is referenced in the JCL of a later step of this job (the data set is not DEQed until it is unallocated by the last step whose JCL references it).
  • Although temporary data sets are never able to be used by other jobs, if the last reference to a temporary data set in the job is PASS, the system releases a:
    • Temporary VIO data set at the end of the last step in which it is referenced
      Note: The system never ENQs VIO data sets.
    • Releases a batch-allocated temporary non-VIO data set at the end of the job.