View previous topic :: View next topic |
Author |
Message |
bolineni ravi Beginner
Joined: 29 Jun 2006 Posts: 4 Topics: 3
|
Posted: Thu Aug 10, 2006 10:54 pm Post subject: Check whether Dataset is existed or not |
|
|
Hi All,
I am executing the REXX program under TSO environment. And my program is writting data into one Physical Sequential(PS) file.
I choose the Parameter as "NEW" While creating PS. while executing my program second time with out deleting the Physical Sequential(PS) file, i am getting the following description(it's not an error) even though i perform the code for deleting the existing dataset(PS).
Following is the error description:
Code: |
DATA SET IND9437.FINL.REPORT NOT ALLOCATED+
IGD17101I DATA SET IND9437.FINL.REPORT
NOT DEFINED BECAUSE DUPLICATE NAME EXISTS IN CATALOG
RETURN CODE IS 8 REASON CODE IS 38 IGG0CLEH
ENTRY (A) IND9437.FINL.REPORT DELETED
OUTDATASET- IND9437.FINL.REPORT SUCCESSFULLY ALLOCATED.
-----------------*****************************---------------------
THE DETAILED & SUMMARY REPORTS ARE IN THE DATASET: IND9437.FINL.REPORT
-----------------*****************************---------------------
I think it is trying to crerate a dataset already existing one. That's the reason i am getting the above description.
Following is my code:
OUTDSNAME = STRIP(USERID())||".FINL.REPORT"
"ALLOC F(DDOUT) DA('"||OUTDSNAME||"') NEW " ||,
" RECFM(F) DSORG(PS) LRECL(80)"
IF RC > 0 THEN
DO
"DELETE '"||OUTDSNAME||"' PURGE"
"ALLOC F(DDOUT) DA('"||OUTDSNAME||"') NEW " ||,
" RECFM(F) DSORG(PS) LRECL(80)"
IF RC > 0 THEN
DO
SAY "ERROR!!! ALLOCATING THE OUTPUT DATASET."
EXIT
END
ELSE
SAY 'OUTDATASET- '||OUTDSNAME|| ' SUCCESSFULLY ALLOCATED.'
END
"EXECIO * DISKW DDOUT (STEM OUT. FINIS"
IF RC = 0 THEN
DO
SAY
SAY '-----------------*****************************--------------
SAY
SAY'THE DETAILED & SUMMARY REPORTS ARE IN THE DATASET: '|| OUTDSNAME
SAY
SAY '-----------------*****************************--------------
END;
"FREE F(DDOUT)"
EXIT
|
Can i check whether the dataset is existed or not in my code. If it is possible can you share some sample code. I can delete the Dataset manually and execute the REXX program second time it is not showing the above description. I don't want manually deletion and i want to do thru code.
Could you please help me out in this regard.
Always Thanking you,
Ravi. |
|
Back to top |
|
 |
German Castillo Beginner

Joined: 23 Dec 2005 Posts: 83 Topics: 2 Location: Caracas, Venezuela
|
Posted: Thu Aug 10, 2006 11:41 pm Post subject: |
|
|
Sure it is posible, just use the sysdsn function, something like this:
If SYSDSN(OUTDATASET) = "OK" Then ... _________________ Best wishes,
German Castillo |
|
Back to top |
|
 |
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Fri Aug 11, 2006 12:18 am Post subject: |
|
|
normally, you do the first allocation with disp=old and if that does not work you recreate the data set. The way you have it, you will always (after the 1st time) be doing 2 allocates and a delete. |
|
Back to top |
|
 |
bolineni ravi Beginner
Joined: 29 Jun 2006 Posts: 4 Topics: 3
|
Posted: Fri Aug 11, 2006 4:09 am Post subject: Check whether Dataset is existed or not |
|
|
Hi All,
I am very much Thankful to you for quick replies. Thanks a lot..
German Castillo,
The function SYSDSN mentioned by you is working fine for my case. Once again thank you very much.
The function SYSDSN - Returns information about whether a given Dataset name is available for use
Always Thanking You,
Ravi. |
|
Back to top |
|
 |
Steve Coalbran Beginner
Joined: 09 Mar 2005 Posts: 22 Topics: 0 Location: Stockholm, Sweden
|
Posted: Sun Aug 13, 2006 12:57 pm Post subject: |
|
|
Hi German,
You can get a lot of info from LISDSI. Check it out in the "z/OS TSOE REXX Reference" (SA22-7790-06).
SYSDSN is probably fine for now but if you need to know more then this is your function!
/Steve  |
|
Back to top |
|
 |
anbesivam Beginner
Joined: 09 Aug 2006 Posts: 66 Topics: 14
|
Posted: Wed Aug 16, 2006 7:38 am Post subject: |
|
|
Hi All,
Hope continuation of this thread will give soultion for my question.
I am getting DDNAME from JCL and using LISTDSI, I getting PDS member name.
After getting the PDS name, I am assigning that PDS name(xxxx.xxx.xxx) in to DNAME and
Checking it's existance like
IF SYSDSN(DNAME) = "OK"
If i am trying to give like above it say DATASET NOT FOUND.
So I tried to give with in SYSDSN("'"!!DNAME!!"'") (with in Single quotes)
It is working fine for me.
Here is my question, For nagative testing i have tried through passing non-exesting data set name from JCL. For that also, SYSDSN("'"!!DNAME!!"'") saying OK. But it shoud say DATASET NOT FOUND.
Could you please explain why this is happening ? |
|
Back to top |
|
 |
coolman Intermediate
Joined: 03 Jan 2003 Posts: 283 Topics: 27 Location: US
|
Posted: Wed Aug 16, 2006 3:00 pm Post subject: |
|
|
I'm giving an example of how SYSDSN should be used when the dataset name is passed as a variable
Quote: |
variable = "exec"
x = SYSDSN(variable) /* looks for 'userid.exec' */
y = SYSDSN('variable') /* looks for 'userid.variable' */
z = SYSDSN("'"variable"'") /* looks for 'exec' */
|
Your parameters are not correct which may lead to the inconsistent results
________
Ford FE engine specifications
Last edited by coolman on Sat Feb 05, 2011 1:48 am; edited 1 time in total |
|
Back to top |
|
 |
anbesivam Beginner
Joined: 09 Aug 2006 Posts: 66 Topics: 14
|
Posted: Thu Aug 17, 2006 3:52 am Post subject: |
|
|
Really Thanks for the information.
Following is my Rexx code ( I am giving some more info about this)
Code: |
/* REXX*/
ARG PDSNAME
CALL LISTDSI(PDSNAME FILE)
DNAME = SYSDSNAME
RC = SYSDSN(" ' "DNAME" ' ")
SAY 'RC ' RC
|
Form My JCL I am passing
For Positive test ( Which is exist)
Code: |
//DD1 DD DSN=XXXXXXX.TEST.JCL,DISP=SHR
|
For Negative test ( Which is not exist)
Code: |
//DD1 DD DSN=XXXXXXX.TEST.JCL123
|
For both the DNAME in rexx, I am getting RC is OK. This is the problem. |
|
Back to top |
|
 |
ofer71 Intermediate
Joined: 12 Feb 2003 Posts: 358 Topics: 4 Location: Israel
|
Posted: Thu Aug 17, 2006 4:50 am Post subject: |
|
|
If the dataset is not exist, your JCL should end with JCL error.
O.
________
Shemale Japanese
Last edited by ofer71 on Thu Mar 17, 2011 10:50 am; edited 1 time in total |
|
Back to top |
|
 |
anbesivam Beginner
Joined: 09 Aug 2006 Posts: 66 Topics: 14
|
Posted: Thu Aug 17, 2006 5:08 am Post subject: |
|
|
If you are saying DISP in JCL for Dataset and Dataset not exist, You will get JCL error.
In my case, I am not giving DISP for non existing dataset and I am not getting any JCL error. |
|
Back to top |
|
 |
ofer71 Intermediate
Joined: 12 Feb 2003 Posts: 358 Topics: 4 Location: Israel
|
Posted: Thu Aug 17, 2006 5:57 am Post subject: |
|
|
According to the fine manual, when you omit the DISP parameter, it assigns DISP=NEW by default. This means that the dataset is created when the job starts.
O.
________
Healthy Relationship Advice Forum
Last edited by ofer71 on Thu Mar 17, 2011 10:50 am; edited 1 time in total |
|
Back to top |
|
 |
anbesivam Beginner
Joined: 09 Aug 2006 Posts: 66 Topics: 14
|
Posted: Thu Aug 17, 2006 7:22 am Post subject: |
|
|
Thanks much for your immt. response.
So In this case, I cann't check my negative test case using JCL.
 |
|
Back to top |
|
 |
ofer71 Intermediate
Joined: 12 Feb 2003 Posts: 358 Topics: 4 Location: Israel
|
Posted: Thu Aug 17, 2006 8:16 am Post subject: |
|
|
Sure you can, just don't use ddnames. For example, from your REXX try:
Code: | RC = SYSDSN('DUMMY.NAME') |
O.
________
Yamaha YZF-R6
Last edited by ofer71 on Sat Feb 05, 2011 11:41 am; edited 1 time in total |
|
Back to top |
|
 |
anbesivam Beginner
Joined: 09 Aug 2006 Posts: 66 Topics: 14
|
Posted: Thu Aug 17, 2006 8:33 am Post subject: |
|
|
Yes, You are correct. In this way I tried before and got the correct result.
But If I want to pass DSN from JCL is the problem for me.
 |
|
Back to top |
|
 |
superk Advanced

Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Thu Aug 17, 2006 8:41 am Post subject: |
|
|
Pass the dataset name as a parameter, then. |
|
Back to top |
|
 |
|
|