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 

Check whether Dataset is existed or not
Goto page 1, 2  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
bolineni ravi
Beginner


Joined: 29 Jun 2006
Posts: 4
Topics: 3

PostPosted: Thu Aug 10, 2006 10:54 pm    Post subject: Check whether Dataset is existed or not Reply with quote

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
View user's profile Send private message
German Castillo
Beginner


Joined: 23 Dec 2005
Posts: 83
Topics: 2
Location: Caracas, Venezuela

PostPosted: Thu Aug 10, 2006 11:41 pm    Post subject: Reply with quote

Sure it is posible, just use the sysdsn function, something like this:

If SYSDSN(OUTDATASET) = "OK" Then ...
_________________
Best wishes,

German Castillo
Back to top
View user's profile Send private message
semigeezer
Supermod


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

PostPosted: Fri Aug 11, 2006 12:18 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
bolineni ravi
Beginner


Joined: 29 Jun 2006
Posts: 4
Topics: 3

PostPosted: Fri Aug 11, 2006 4:09 am    Post subject: Check whether Dataset is existed or not Reply with quote

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
View user's profile Send private message
Steve Coalbran
Beginner


Joined: 09 Mar 2005
Posts: 22
Topics: 0
Location: Stockholm, Sweden

PostPosted: Sun Aug 13, 2006 12:57 pm    Post subject: Reply with quote

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!

Smile /Steve Cool
Back to top
View user's profile Send private message Send e-mail MSN Messenger
anbesivam
Beginner


Joined: 09 Aug 2006
Posts: 66
Topics: 14

PostPosted: Wed Aug 16, 2006 7:38 am    Post subject: Reply with quote

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
View user's profile Send private message
coolman
Intermediate


Joined: 03 Jan 2003
Posts: 283
Topics: 27
Location: US

PostPosted: Wed Aug 16, 2006 3:00 pm    Post subject: Reply with quote

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
View user's profile Send private message
anbesivam
Beginner


Joined: 09 Aug 2006
Posts: 66
Topics: 14

PostPosted: Thu Aug 17, 2006 3:52 am    Post subject: Reply with quote

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
View user's profile Send private message
ofer71
Intermediate


Joined: 12 Feb 2003
Posts: 358
Topics: 4
Location: Israel

PostPosted: Thu Aug 17, 2006 4:50 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
anbesivam
Beginner


Joined: 09 Aug 2006
Posts: 66
Topics: 14

PostPosted: Thu Aug 17, 2006 5:08 am    Post subject: Reply with quote

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
View user's profile Send private message
ofer71
Intermediate


Joined: 12 Feb 2003
Posts: 358
Topics: 4
Location: Israel

PostPosted: Thu Aug 17, 2006 5:57 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
anbesivam
Beginner


Joined: 09 Aug 2006
Posts: 66
Topics: 14

PostPosted: Thu Aug 17, 2006 7:22 am    Post subject: Reply with quote

Thanks much for your immt. response.

So In this case, I cann't check my negative test case using JCL.

Sad
Back to top
View user's profile Send private message
ofer71
Intermediate


Joined: 12 Feb 2003
Posts: 358
Topics: 4
Location: Israel

PostPosted: Thu Aug 17, 2006 8:16 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
anbesivam
Beginner


Joined: 09 Aug 2006
Posts: 66
Topics: 14

PostPosted: Thu Aug 17, 2006 8:33 am    Post subject: Reply with quote

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.

Sad
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Thu Aug 17, 2006 8:41 am    Post subject: Reply with quote

Pass the dataset name as a parameter, then.
Back to top
View user's profile Send private message
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
Goto page 1, 2  Next
Page 1 of 2

 
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