View previous topic :: View next topic |
Author |
Message |
rajat_gupta Beginner

Joined: 30 May 2007 Posts: 13 Topics: 5 Location: India
|
Posted: Mon Oct 15, 2007 1:49 am Post subject: Problem in Deletion of datasets in REXX |
|
|
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 |
|
 |
vivek1983 Intermediate

Joined: 20 Apr 2006 Posts: 222 Topics: 24
|
Posted: Mon Oct 15, 2007 4:41 am Post subject: |
|
|
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 |
|
 |
rajat_gupta Beginner

Joined: 30 May 2007 Posts: 13 Topics: 5 Location: India
|
Posted: Mon Oct 15, 2007 6:36 am Post subject: |
|
|
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 |
|
 |
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Mon Oct 15, 2007 1:16 pm Post subject: |
|
|
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 |
|
 |
rajat_gupta Beginner

Joined: 30 May 2007 Posts: 13 Topics: 5 Location: India
|
Posted: Tue Oct 16, 2007 7:10 am Post subject: |
|
|
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 |
|
 |
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Tue Oct 16, 2007 8:57 am Post subject: |
|
|
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 |
|
 |
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
|
Back to top |
|
 |
|
|