Scan mainframe Catalogs

Executing batch TSO to run IDCAMS can access mainframe catalogs to generate a file that can be read by SAS and analyzed. To select the section of the catalog you are interested in, the first step should be to create the IDCAMS command using SAS. This 3 step job, using SAS to select part of catalog, batch TSO running IDCAMS, and SAS to review the catalog listing can assist the program in using external data sets or tailor the catalog listing.

I found it helpful keeping track of data sets that I was responsible for. When combined with allocating data sets with SAS control card, it prevented allocation errors. Using This technique, SAS program flow can be altered depending on data availability.

Generate IDCAMS command

Batch TSO running IDCAMS

//STEP1    EXEC SAS,SASAUTO='SAS macro Library',
//         PARM='SYSPARM="TA0001"'
//IDCAMCTL DD DSN=&&IDCAMCTL,DISP=(NEW,PASS),
//         UNIT=SYSDA,SPACE=(TRK,(1,1)),
//         DCB=(RECFM=FB,LRECL=80) 
//STEP2    EXEC PGM=IKJEFT01 
//SYSIN    DD DISP=SHR,DSN=YOUR.SAS.LIBRARY(IDCAM) 
//SYSTSPRT DD DSN=&&TEMP,DISP=(NEW,PASS),UNIT=SYSDA,
//         SPACE=(CYL,(10,10)),DCB=(RECFM=FBA,LRECL=133)
//SYSTSIN  DD DSN=&&IDCAMCTL,DISP=(OLD,PASS)
//STEP3    EXEC SAS,SASAUTO='PF3095A.SAS.CNTLM'
//TEMP     DD DISP=OLD,DSN=&TEMP
//IDCAMCTL DD DISP=OLD,DSN=&&IDCAMCTL
//SYSIN    DD DISP=SHR,DSN=YOUR.SAS.LIBRARY(TAILOR)

Review catalog listing