Is it possible to use wild characters to delete dataset on z/OS Is it possible to use wild characters to delete dataset on z/OS unix unix

Is it possible to use wild characters to delete dataset on z/OS


Rexx ISPF option is probably the easiest and can be used in the future, but options include:

  • Use the save command in ispf 3.4 to save to a file, then use a rexx program on the file created by the save command

  • listcat command, in particular

    listcat lvl(MYTEST) ofile(ddname)

    then write a rexx program to do the actual delete

  • Alternatively you can use the ISPF services LMDINIT, LMDLISTY & LMDFREE in a rexx program running under ISPF i.e.

       /* Rexx ispf program to process datasets */       Address ispexec        "LMDINIT LISTID(lidv)  LEVEL(MYTEST)"       "LMDLIST LISTID("lidv") OPTION(list) dataset(dsvar) stats(yes)"       do while rc = 0          /* Delete or whatever */       end       "LMDFREE LISTID("lidv")"

For all these methods you need to fully qualify the first High level qualifier.


Learning what Rexx / ISPF will serve you into the future. In the ISPF Editor, you can use the model command to get Templates / information for all the ISPF commands:

 Command ====> Model LMDINIT 

will add a template for the lmdinit command. There are templates for rexx, cobol, pl1, ISPF-panels, ISPF-skeletons messages etc.


Thanks Bruce for the comprehensive answer. According to Bruce's tips, I just worked out a one-line Shell command as below:

 tsocmd "listcat lvl(MYTEST) " | grep -E "MYTEST(\..+)+" | cut -d' ' -f3 | xargs -I '{}' tsocmd "delete '{}'"

Above command works perfectly.


Update - The IDCAMS DELETE command has had the MASK operand for a while. You use it like:

DELETE 'MYTEST.**' MASK

Documentation for z/OS 2.1 is here.