Marc
Marc

Reputation: 33

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

Upvotes: 2

Views: 2276

Answers (1)

David Crayford
David Crayford

Reputation: 571

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

Upvotes: 6

Related Questions