Programs process data sets in the following sequence:
- Allocate the data set to establish the logical link between a
program and a data set. You can do this either outside the program
with JCL or the TSO ALLOCATE command or inside the program with dynamic
allocation.
- Open the data set, identifying it with a DDNAME.
- Do reads and writes using an access method.
- Close the data set.
- Deallocate the data set. There are three ways to do this:
- For non-VSAM data sets only, specifying FREE=CLOSE when closing
the data set. (The FREE=CLOSE parameter is ignored for VSAM data sets.)
- Your program can call dynamic deallocation.
- During the step termination process, the operating system automatically
deallocates any remaining allocated data sets.