JCL to delete members in PDS in Mainframe



The Sample JCLs below deletes all the members in a PDS.


Example 1:-


Step 1> Create a sequential dataset (for example SAMPLE. EXAMPLE.FILE.) with all Delete instructions for the members  such as:-

DELETE 'SAMPLE.DATA.FILE1 (DATA1)'
DELETE 'SAMPLE.DATA.FILE2 (DATA2)'
.....
.....
etc

We can mention in SYSIN with the dataset like below

//SORTNAM EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD DSN=SAMPLE. EXAMPLE.FILE,DISP=SHR
/*


Then it will delete all the members in the dataset SAMPLE. EXAMPLE.FILE.




Example 2:-

The JCL below also deletes the members in PDS EXAMPLE.PDS.NAME



//STEP01 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//IN  DD DUMMY
//OUT DD DSN=EXAMPLE.PDS.NAME.,DISP=OLD
//SYSIN DD *
REPRO IFILE(IN) OFILE(OUT) REPLACE
/*

No comments:

Post a Comment