ChrisHoelscher

How to empty a PDS(/E) without deleting it

Discussion created by ChrisHoelscher on Apr 5, 2015

maybe i am the last person in the world to stumble acrss this; if so i fell pretty lame ...

when upgrading to a new release of IDMS (or any mainframe product, for that manner) we re-use the runtime libraries -  the dataset names are NOT release dependent - it would be easy to delete/allocate the datasets - EXCEPT - with our globally-distributed workforce, there seems to always be someone logged on with the dataset in their TSO allocate member - we used to have to knowck them off tso to free the allocation on the datasets . UNTIL ...

 

we stumbled into the following:

 

/* REXX */                                                     

DSNAME = 'your llibrary to be cleaned out'                               

DSN = STRIP(DSNAME, 'BOTH', '''') /* IN CASE IT'S IN QUOTES */ 

QUOTE = "'"                                                    

QDSN  = QUOTE||DSN||QUOTE         /* FULLY QUOTED DSN */       

                                                               

ADDRESS ISPEXEC                                                

"LMINIT  DATAID( MYDATAID)  DATASET(" QDSN ") ENQ(SHRW)"       

"LMOPEN  DATAID("MYDATAID") OPTION(OUTPUT)"                    

"LMMDEL  DATAID("MYDATAID") MEMBER(*)"                         

"LMCLOSE DATAID("MYDATAID")"                                   

"LMFREE  DATAID("MYDATAID")"                                   

                                                               

SAY DSN " IS NOW EMPTY"         

 

 

its quick and it works!(this can be stacked multiple times for multiple datasets within one execution                             

Outcomes