Directing Output to External Files with DD Statements

In a z/OS batch job, you can use the SASLOG DD and SASLIST DD statements to change the destination of the SAS log and procedure output file. These statements override the DD statements in the SAS cataloged procedure. Therefore, the position of these statements in your JCL is important. You must place the SASLOG DD statement and the SASLIST DD statement in the same order as they appear in the SAS cataloged procedure. Also, these statements must follow the JCL EXEC statement, and they must precede the DD statements for any ddnames that are not included in the cataloged procedure (such as SYSIN).
For example, the following example directs the SAS log to member DEPT of an existing partitioned data set and directs the procedure output to an existing sequential data set:
//REPORT  JOB accounting-information,
//        MSGLEVEL=(1,1)
//SASSTEP EXEC SAS,OPTIONS='LINESIZE=80 NOSTATS'
//SASLOG  DD DSN=MYID.MONTHLY.REPORT(DEPT),
//        DISP=OLD
//SASLIST DD DSN=MYID.MONTHLY.OUTPUT,DISP=MOD
//SYSIN  DD *
SAS statements
//
Note: SASLOG and SASLIST are the default ddnames of the SAS log and procedure output files. If these ddnames have been changed in your site's SAS cataloged procedure, then use your site's ddnames in place of SASLOG and SASLIST.
CAUTION:
The SAS cataloged procedure specifies default DCB characteristics unless you specify them in the SASLOG or SASLIST DD statement.
If you are directing the SAS log to a member of a partitioned data set whose DCB characteristics that are different from the characteristics given in SAS Log File, then you must include the existing DCB characteristics in the SASLOG DD statement. Similarly, if you are directing the SAS procedure output to a member of a partitioned data set whose DCB characteristics are different from the characteristics that given in SAS Procedure Output File, then you must include the existing DCB characteristics in the SASLIST DD statement. Otherwise, the existing DCB characteristics of the partitioned data set are changed to the characteristics that are specified for SASLOG or SASLIST in the SAS cataloged procedure, making the other members of the partitioned data set unreadable.