unixdatasetmainframezostso

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


I want to remove lots of temporary PS datasets with dataset name like MYTEST.**, but still can't find an easy way to handle the task.
I meant to use a Shell command below to remove them

  cat "//'dataset.list'"| xargs -I '{}' tsocmd "delete '{}'"

However, first I have to save the dataset list into a PS dataset or Unix file. In Unix, we can redirect output of ls command into a text file: "ls MYTEST.* > dslist", but on TSO or ISPF panel, seems no simple command to do that.

Anyone has any clue on this? Your comment would be appreciated.


Solution

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

           /* 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.