Normally it is easy to delete all members without REXX.
The command s * d would do this for you.
Incase, if you have a list of members to be deleted from a huge list, then it is better to automate with REXX.
/*REXX*/
PDSNAME = "Your PDS Name"
CALL OUTTRAP "MEM."
"LISTD" "'"PDSNAME"'" "MEMBERS"
CALL OUTTRAP "OFF"
DO I=1 TO MEM.0
IF MEM.I = "--MEMBERS--" THEN LEAVE
END
I = I+1
DO J = I TO MEM.0
PARSE VALUE MEM.J WITH MEMNAME
MEMNAME=STRIP(MEMNAME)
/* You shall have your IF or WHEN condition to delete */
CALL OUTTRAP "DUMMY."
ADDRESS TSO "DELETE '"PDSNAME"("MEMNAME")'"
CALL OUTTRAP "OFF"
END
Showing posts with label LISTD. Show all posts
Showing posts with label LISTD. Show all posts
Saturday, August 20, 2016
Wednesday, August 10, 2016
REXX LISTD Command: Reading all member names from a PDS
When we have only handful of members in a PDS, it is easily to make a list of their names. Imagine if we have 1000 members in a PDS. Some may do it manually but some use REXX script to do this task quickly.
Lets see how to do this in REXX.
PDSNAME="Your-PDS Name"
CALL OUTTRAP "MBRS."
"LISTD" "'"PDSNAME"'" "MEMBERS"
CALL OUTTRAP "OFF"
DO I=1 TO MBRS.0
IF MBRS.I = "--MEMBERS--" THEN LEAVE
END
I = I+1
DO MEM = I TO MBRS.0
Say "Member Name ;" MBRS.MEM
END
This code would display all the members in a PDS. Instead of displaying the member name you shall add your own logic to fulfill your requirement.
Lets see how to do this in REXX.
PDSNAME="Your-PDS Name"
CALL OUTTRAP "MBRS."
"LISTD" "'"PDSNAME"'" "MEMBERS"
CALL OUTTRAP "OFF"
DO I=1 TO MBRS.0
IF MBRS.I = "--MEMBERS--" THEN LEAVE
END
I = I+1
DO MEM = I TO MBRS.0
Say "Member Name ;" MBRS.MEM
END
This code would display all the members in a PDS. Instead of displaying the member name you shall add your own logic to fulfill your requirement.
Subscribe to:
Posts (Atom)
Featured Post
REXX Skeleton: Submitting jobs through Rexx
Submitting jobs through REXX and reading the spool through REXX gives us immense potential to automate many manual activities in mainframes....
-
In order to read the dataset and member name of the opened member, use the following REXX code. After executing this REXX code, the varia...
-
Abend S013 SYSTEM COMPLETION CODE=013 REASON CODE=00000018 AN OPEN WAS ISSUED FOR A PARTITIONED DATASET. THE SPECIFIED MEMBER NAME WAS N...
-
We shall read all member names using LISTDS "Dataset" Members. But however, I felt that this technique requires some logic to igno...