Monday, September 26, 2011

Retrieve full dataset name if you know the partial dataset name

If you know only last portion of  a dataset name, then you can use the below job to retrieve the full dataset name. If you know the name of catalog, in which your datasets resides, then the following jcl will help you. The first step in the job retrieves all the dataset names from the catalog and then the second SORT step matches the portion of the dataset name that you know with all the dataset names retrieved in the first step and writes the matching dataset names to the output.

//STEP010 EXEC PGM=IDCAMS
//SYSPRINT DD DSN=&&LIST,DISP=(,PASS),
// SPACE=(CYL,(1,1)),LRECL=125,RECFM=FBA
//SYSIN DD *
LISTCAT CATALOG('USER.CATALOG')
//*
//STEP020 EXEC PGM=SYNCTOOL
//SSMSG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//DD1 DD DSN=&&LIST,DISP=(OLD,DELETE)
//DD2 DD DSN=&&TEMP,DISP=(,PASS),LRECL=80,RECFM=FB,
// SPACE=(CYL,(1,1))
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(DD1) TO(DD2) USING(CTL1)
COPY FROM(DD2) TO(OUT) USING(CTL2)
//CTL1CNTL DD *
OUTREC FIELDS=(6,80),CONVERT
//CTL2CNTL DD *
INCLUDE COND=(1,80,SS,EQ,C'PART OF THE DATASET NAME HERE')
//*

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.