IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Delete all members of a PDS using a REXX


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
gcchowdary
Warnings : 1

New User


Joined: 26 Dec 2005
Posts: 18
Location: India

PostPosted: Thu Dec 28, 2006 2:18 pm
Reply with quote

Hi All..
How can we delete all the members of a PDS without deleting the PDS itself using REXX. Suppose, I have a PDS but i don't know the exact number of members in it. Now, I want to perform the above delete operation using REXX.

Is there any ways to do so...Please advise.


Thank You..
G C Chowdary
Back to top
View user's profile Send private message
avaneendra_linga

New User


Joined: 13 Dec 2006
Posts: 73
Location: Hyderabad

PostPosted: Thu Dec 28, 2006 2:33 pm
Reply with quote

HI,

YOU CAN DELETE THE MEMBERS USING TSO DELETE OPTION.
EX: ADDRESS TSO "DELETE A.B.C("MEMBER")"
this will delete the member only. for deleting all members u can put this in loop.
Back to top
View user's profile Send private message
gcchowdary
Warnings : 1

New User


Joined: 26 Dec 2005
Posts: 18
Location: India

PostPosted: Thu Dec 28, 2006 2:39 pm
Reply with quote

Thanks once again Linga. But suppose i don't know the member names and the exact number of members present.
In this case, do you have any idea.

Thank You..
G C Choudary
Back to top
View user's profile Send private message
avaneendra_linga

New User


Joined: 13 Dec 2006
Posts: 73
Location: Hyderabad

PostPosted: Thu Dec 28, 2006 2:51 pm
Reply with quote

hi i think this can help u....this will delete all members..

"lminit dataid(indata) dataset('"pds"')"
if rc\=0 then do
say 'S ->' zerrsm
say rc
signal abnormalend
end
"lmopen dataid("indata") option(input)"
if rc\=0 then do
say 'S ->' zerrsm
say rc
signal abnormalend
end
emname = ''
"lmmlist dataid("indata") option(list) member(memname)"
lrc = rc
do while lrc = 0
say 'I-> processing member' memname
memname = strip(memname)

filename=pds||"("||memname||")"

address tso "delete filename"
"lmmlist dataid("indata") option(list) member(memname)"
lrc = rc
end
i=i+1
end /* end of ps file */
Back to top
View user's profile Send private message
avaneendra_linga

New User


Joined: 13 Dec 2006
Posts: 73
Location: Hyderabad

PostPosted: Thu Dec 28, 2006 2:54 pm
Reply with quote

hi in the above code ...
u have to delete last two lines..

i=i+1
end /* end of ps file */
Back to top
View user's profile Send private message
gcchowdary
Warnings : 1

New User


Joined: 26 Dec 2005
Posts: 18
Location: India

PostPosted: Thu Dec 28, 2006 5:00 pm
Reply with quote

Hi Linga,
I got the below error while executing the above code:

COMMAND LMINIT NOT FOUND
"LMINIT DATAID("DPFCB.XYZ.TEST2") DATASET('"PDS"')"
RC(-3) +++

Please suggest...

Thanks..
G C Choudary.
Back to top
View user's profile Send private message
avaneendra_linga

New User


Joined: 13 Dec 2006
Posts: 73
Location: Hyderabad

PostPosted: Thu Dec 28, 2006 5:05 pm
Reply with quote

in dataid ...u need to give the ddname. and pds is a variable so first u need to declare the pds before this command.

so use my code as it is.....only thing u need to do is ..declare pds variable first.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Thu Dec 28, 2006 6:40 pm
Reply with quote

Using TSO and REXX:

Code:

/* REXX EMPTY PDS */                         
thepds = 'THE.PDS'                             
x = Outtrap('ml.')                           
"LISTDS "thepds" MEMBERS"                   
x = Outtrap('Off')                           
Do n = 7 To ml.0                             
  Parse Var ml.n member .                   
  "DELETE "thepds"("member")"               
End                                         
Exit 0                                       


Using ISPF Library Management Services (generically):

Code:

LMINIT DATAID(did) DATASET('THE.PDS') ENQ(EXCLU)
<< or >>
LMINIT DATAID(did) DDNAME(DDNAME) ENQ(EXCLU)
LMOPEN DATAID(&did) OPTION(OUTPUT)
LMMDEL DATAID(&did) MEMBER(*) NOENQ
LMCLOSE DATAID(&did)
LMFREE DATAID(&did)


For a batch solution using SAS:

Code:

//SASSTEP  EXEC SAS                               
//SAS.SASLOG  DD SYSOUT=*                         
//SAS.SYSDUMP DD SYSOUT=*                         
//SAS.SASLIST DD SYSOUT=*                         
//SYSUT1   DD DISP=SHR,DSN=THE.PDS           
//SYSIN    DD *                                 
PROC PDS DDNAME=SYSUT1 KILL;                       
RUN;                                               
Back to top
View user's profile Send private message
sparrow

New User


Joined: 26 Mar 2007
Posts: 57
Location: Pune

PostPosted: Wed Jan 23, 2008 6:35 pm
Reply with quote

Kevin,

I tried this using REXX, The PDS name is "MYUSRID.TEST". When I run the program it adds one more "MYUSRID" in front of the dataset as "MYUSRID.MYUSRID.TEST". Please help me how can I get rid of this "MYUSRID" in front
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Wed Jan 23, 2008 6:51 pm
Reply with quote

Please post a REXX TRACE output of your process.
Back to top
View user's profile Send private message
sparrow

New User


Joined: 26 Mar 2007
Posts: 57
Location: Pune

PostPosted: Wed Jan 23, 2008 7:13 pm
Reply with quote

Hi Kevin, Here is my TRACE output. This time its different message. But it the members are not deleted.

3 *-* THEPDS = 'XXXXXX.TEST'
>>> "'XXXXXX.TEST"
+++ Interactive trace. TRACE OFF to end debug, ENTER to continue. +++

4 *-* X = OUTTRAP('ML.')
>>> "ML."

5 *-* "LISTDS "THEPDS" MEMBERS"
>>> "LISTDS XXXXXX.TEST MEMBERS"

6 *-* X = OUTTRAP('OFF')
>>> "OFF"

7 *-* DO N = 7 TO ML.0
>>> "7"
>>> "6"

11 *-* EXIT
***
Back to top
View user's profile Send private message
sparrow

New User


Joined: 26 Mar 2007
Posts: 57
Location: Pune

PostPosted: Wed Jan 23, 2008 7:18 pm
Reply with quote

Hi Kevin,

Its working if I give only the second node i.e THEPDS = "TEST"

Please suggest.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Wed Jan 23, 2008 8:20 pm
Reply with quote

sparrow wrote:
When I run the program it adds one more "MYUSRID" in front of the dataset as "MYUSRID.MYUSRID.TEST". Please help me how can I get rid of this "MYUSRID" in front

TSO will add your userid as a prefix unless you:
- place the name between quotes: 'MYUSRID.TEST' (in addition to the double quotes).
- run the TSO PROF NOPREF command.

gcchowdary wrote:
I got the below error while executing the above code:

COMMAND LMINIT NOT FOUND
"LMINIT DATAID("DPFCB.XYZ.TEST2") DATASET('"PDS"')"
RC(-3) +++

Please suggest...

LMINIT and other LM command belong to ISPF.
By default, commands are sent to TSO, so you should do:
Address ISPEXEC "LMINIT..."
Back to top
View user's profile Send private message
sparrow

New User


Joined: 26 Mar 2007
Posts: 57
Location: Pune

PostPosted: Wed Jan 23, 2008 8:22 pm
Reply with quote

Thank you
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Jan 24, 2008 12:42 am
Reply with quote

Hello,

Now that you've gone thru all of that to delete all of the members, was there any real reason that the pds was not simply deleted and re-allocated?

The "code" method took both more people time as well as more system resources.

If there is something i've misunderstood, please enlighten me.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts DELETE SPUFI DB2 1
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts DSNTIAUL driven delete IBM Tools 0
Search our Forums:

Back to Top