View previous topic :: View next topic
|
Author |
Message |
gcchowdary Warnings : 1 New User
Joined: 26 Dec 2005 Posts: 18 Location: India
|
|
|
|
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 |
|
|
avaneendra_linga
New User
Joined: 13 Dec 2006 Posts: 73 Location: Hyderabad
|
|
|
|
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 |
|
|
gcchowdary Warnings : 1 New User
Joined: 26 Dec 2005 Posts: 18 Location: India
|
|
|
|
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 |
|
|
avaneendra_linga
New User
Joined: 13 Dec 2006 Posts: 73 Location: Hyderabad
|
|
|
|
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 |
|
|
avaneendra_linga
New User
Joined: 13 Dec 2006 Posts: 73 Location: Hyderabad
|
|
|
|
hi in the above code ...
u have to delete last two lines..
i=i+1
end /* end of ps file */ |
|
Back to top |
|
|
gcchowdary Warnings : 1 New User
Joined: 26 Dec 2005 Posts: 18 Location: India
|
|
|
|
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 |
|
|
avaneendra_linga
New User
Joined: 13 Dec 2006 Posts: 73 Location: Hyderabad
|
|
|
|
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 |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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 |
|
|
sparrow
New User
Joined: 26 Mar 2007 Posts: 57 Location: Pune
|
|
|
|
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 |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
Please post a REXX TRACE output of your process. |
|
Back to top |
|
|
sparrow
New User
Joined: 26 Mar 2007 Posts: 57 Location: Pune
|
|
|
|
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 |
|
|
sparrow
New User
Joined: 26 Mar 2007 Posts: 57 Location: Pune
|
|
|
|
Hi Kevin,
Its working if I give only the second node i.e THEPDS = "TEST"
Please suggest. |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
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 |
|
|
sparrow
New User
Joined: 26 Mar 2007 Posts: 57 Location: Pune
|
|
|
|
Thank you |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
|