IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Check whether Dataset is existed or not


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ravi.bollineni

New User


Joined: 28 Jun 2006
Posts: 8

PostPosted: Thu Aug 10, 2006 7:50 pm
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:
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
superk

Global Moderator


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

PostPosted: Thu Aug 10, 2006 7:56 pm
Reply with quote

Well, ask yourself, since you're in a TSO environment, how would you determine if a dataset exists in TSO?
Back to top
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Thu Aug 10, 2006 7:58 pm
Reply with quote

Why not have the DELETE always present prior to the ALLOC. Don't ALLOC, check the RC, then DELETE and ALLOC. Just DELETE and ALLOC.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
No new posts Allocated cylinders of a dataset DB2 12
Search our Forums:

Back to Top