Search code examples
rexx

REXX command to get the dataset list of the data sets on a volume (comparable with 3.4 "P" for Print data set list)


the question is in the title.

How can I get the list of the data sets on the volume with an REXX command, so I can work with this list.

Thanks for help!

Marc


Solution

  • /* REXX */                                                               
    
      arg volume .                                                           
    
      address ISPEXEC                                                        
    
      if ispexec("LMDINIT LISTID(LID) VOLUME("volume")") >= 8 then exit 8    
    
      do while ispexec("LMDLIST LISTID(&LID) DATASET(DSNAME) STATS(YES)") = 0
        say dsname                                                           
      end                                                                    
    
      call ispexec "LMDFREE LISTID(&LID)"                                    
    
      exit 0                                                                 
    
    ispexec:                                                                 
      arg cmd                                                                
      "CONTROL ERRORS RETURN"                                                
       cmd                                                                   
       res = rc                                                              
       if res >= 8 then do                                                   
         "SETMSG MSG(ISRZ002)"                                               
       end                                                                   
      "CONTROL ERRORS CANCEL"                                                
      return res