REXX to get the membernames in PDS

The following Rexx code can be used to extract member names inside a PDS. This may prove very useful if you want to perform a repeated action on all the members of a PDS, just for example you may want to replace a string with a new value in all the members, then this REXX code will help you to get the list of all members in a PDS and you can write other steps in the macro to perform the steps on these members.

/* REXX  PDS */                                 THEPDS = “‘USERID.ABC.XYZ'”                X = OUTTRAP(‘ML.’)                              “LISTDS “THEPDS” MEMBERS”                       X = OUTTRAP(‘OFF’)                              DO N = 7 TO ML.0                                  PARSE VAR ML.N MEMBER                           MEMBER=STRIP(MEMBER)                          SAY “MEMBER NAME IS ==>” MEMBER                 END                                             

EXIT 0