Allocation of data sets using SAS statements instead of JCL
In many instances it can be advantageous to use SAS statements to access cataloged data sets instead Job Control Language (JCL). SAS can search the catalog for a data set and handle any problems that may arise. In stead of waiting for the job to abdominally terminate, change the JCL and re-start the job.
The SAS job can perform the following corrections:
- Open a data set for output if it exits or allocate it as new
- Allocate a data set as new but if it exists first delete it
- Allocate a data set as new and use it if it exits
A serious and common problem occurs when allocating a data set as new but it has been previously allocated and cataloged. The new data set is allocated but it is not cataloged and it location is found only in the jobs error message. If this newly created data set in not manualy catalogged any use of this data set name will use the previously allocated and cataloged data set.
Allocation of data sets using SAS control statements has some limitations. SAS deals only with cataloged data set and can not allocate temporary not cataloged data set. This can result in jobs waiting for a cataloged temporary data set to be free. Another limitation of SAS data set allocation is that external files use a FILENAME statement and SAS data library use a LIBNAME statement. Data sets allocated using JCL so their role as a external file or a SAS data library can be interchanged and the physical data set name.
An IMPORTANT note. JCL disposition of share will not protect a data set from the SAS allocate statements. SAS allocation statements can delete and uncatalog a data set even though the JCL has allocated the data set with disposition of share.