Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Delete all members of a PDS using a REXX

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    Post subject: Delete all members of a PDS using a REXX
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    Post subject: Re: Delete all members of a PDS using a REXX
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    Post subject:
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    Post subject: Re: Delete all members of a PDS using a REXX
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    Post subject: Re: Delete all members of a PDS using a REXX
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    Post subject:
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    Post subject: hi
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

Moderator Team Head


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

PostPosted: Thu Dec 28, 2006 6:40 pm    Post subject: Re: Delete all members of a PDS using a REXX
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    Post subject:
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

Moderator Team Head


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

PostPosted: Wed Jan 23, 2008 6:51 pm    Post subject: Reply to: Delete all members of a PDS using a REXX
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    Post subject:
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    Post subject:
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: 1232
Location: Israel

PostPosted: Wed Jan 23, 2008 8:20 pm    Post subject:
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    Post subject:
Reply with quote

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

Site Director


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

PostPosted: Thu Jan 24, 2008 12:42 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts REXX to get the all datasets name parasmalik20 CLIST & REXX 5 Tue Jul 18, 2017 9:10 pm
No new posts How system know which REXX to excute? jackzhang75 CLIST & REXX 14 Thu Jul 06, 2017 1:09 am
No new posts REXX - Dynamic file Creation d_sarlie CLIST & REXX 7 Tue Jun 27, 2017 7:30 pm
No new posts REXX WTO for console message bipinpeter CLIST & REXX 6 Tue Jun 27, 2017 3:56 pm
No new posts Convert CLIST to REXX cvnlynn CLIST & REXX 12 Tue Jun 27, 2017 2:06 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us