MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problem in Deletion of datasets in REXX

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
rajat_gupta
Beginner


Joined: 30 May 2007
Posts: 13
Topics: 5
Location: India

PostPosted: Mon Oct 15, 2007 1:49 am    Post subject: Problem in Deletion of datasets in REXX Reply with quote

Hi All,
I am trying to delete some datasets in REXX using below command.
"ISPEXEC LMERASE DATASET('"dsn"')"
Now the problem is ,
It is always giving me a Return code of 8 whenever,
- The dataset to be deleted is already open.
- I dont have authorization to delete the dataset.
- etc

Now I need to differentiate that , whether the 8 RC is beacuse of authorization problem or because of something else.
If somebody has any solution for this than pls help.
_________________
Rajat Gupta

when depressing thoughts seem to get you down
Put a smile on your face and thank God you're alive and still around.
Back to top
View user's profile Send private message
vivek1983
Intermediate


Joined: 20 Apr 2006
Posts: 222
Topics: 24

PostPosted: Mon Oct 15, 2007 4:41 am    Post subject: Reply with quote

rajat_gupta,

Do u want to use LMERASE function particularly to delete the dataset?

I use the following method:

1. Check if the dataset exists and if its ready to use using SYSDSN(DATASETNAME).
2. Then delete using "DELETE '"||DATASETNAME||"' PURGE" if the dataset exists and is ready to use.

Display SYSDSN statement and check the status of the dataset.
_________________
Vivek G
--------------------------------------
A dream is just a dream. A goal is a dream with a plan and a deadline. (Harvey Mackay)
Back to top
View user's profile Send private message
rajat_gupta
Beginner


Joined: 30 May 2007
Posts: 13
Topics: 5
Location: India

PostPosted: Mon Oct 15, 2007 6:36 am    Post subject: Reply with quote

Hi Vivek ,
Actually I want to delete all those datasets which are starting with a given qualifier.
For that I am using ,
"ISPEXEC LMDINIT LISTID(listid) LEVEL("HLQ2")"
Do Forever
"ISPEXEC LMDLIST LISTID(&listid) OPTION(LIST) DATASET(dsn)"
If rc <> 0 Then DO
something.....
else
"ISPEXEC LMERASE DATASET('"dsn"')"

But the problem is , that whenver I dataset is not deleted, it is always giving me RC 8 ,irrespective of the reason . My requirement is to just know whether I have the authority to delete it or not.If I can get this , I will get everything.

Thanks for Reply.
_________________
Rajat Gupta

when depressing thoughts seem to get you down
Put a smile on your face and thank God you're alive and still around.
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Mon Oct 15, 2007 1:16 pm    Post subject: Reply with quote

If you do not have authority your security software - usually RACF or ACF2 - should be issuing S913 messages. You can trap those using OUTTRAP and then analyse them.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
rajat_gupta
Beginner


Joined: 30 May 2007
Posts: 13
Topics: 5
Location: India

PostPosted: Tue Oct 16, 2007 7:10 am    Post subject: Reply with quote

Hi Nic,
I tried with Outtrap, but its not showing me anything . the code is,

X=OUTTRAP('LMERASE.')

"ISPEXEC LMERASE DATASET('"DSNAME"')"
SAY "X IS " X
X = OUTTRAP('OFF')

But its displaying me "X is LMERASE. "

Thanks
_________________
Rajat Gupta

when depressing thoughts seem to get you down
Put a smile on your face and thank God you're alive and still around.
Back to top
View user's profile Send private message
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Tue Oct 16, 2007 8:57 am    Post subject: Reply with quote

That isn't how outtrap works. Have a look at the Rexx manual on how to use outtrap. But I don't think outtrap will trap RACF messages anyway.

I believe that what you want here is to get the text of the message. Because the return code of the service is 8 or greater, the message text will be in the variables ZERRSM and ZERRLM in the SHARED pool. Be sure to use the CONTROL ERRORS RETURN service to insure you get control back in the case of errors. If you need to dynamically process the different cases, you can check the message id (ZERRMSG) but that is not generally recommended because IBM does not guarantee that the message numbers will remain the same for all situations (they add and remove messages occasionally).
_________________
New members are encouraged to read the How To Ask Questions The Smart Way FAQ at http://www.catb.org/~esr/faqs/smart-questions.html.


Last edited by semigeezer on Tue Oct 16, 2007 9:00 am; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Tue Oct 16, 2007 8:58 am    Post subject: Reply with quote

deleted accidental duplicate post
_________________
New members are encouraged to read the How To Ask Questions The Smart Way FAQ at http://www.catb.org/~esr/faqs/smart-questions.html.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group