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 

Temp dataset deletion

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
Martin
Beginner


Joined: 20 Mar 2006
Posts: 133
Topics: 58

PostPosted: Tue Jan 30, 2007 5:43 am    Post subject: Temp dataset deletion Reply with quote

Hi All,

I have a step where in I have create a temp dataset ( using &&TEMP) . I need to delete this dataset once the step(This is NOT the last step in the JCL) has finished execution. Below are my observations on this.

MVS allocates a name to this temp dataset.
This dataset gets deleted only at the execution of the last step in the JCL.

Any thoughts on how to achieve this ?

-Mt
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Tue Jan 30, 2007 7:27 am    Post subject: Reply with quote

to create a temp dataset one normally uses disp=(,,pass).

to access this temp dataset in later steps, one normally uses disp(old,,pass);why not use old,delete,delete in the last step that uses the temp dataset?
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
jyoung
Beginner


Joined: 10 Nov 2005
Posts: 36
Topics: 2
Location: Flint, MI

PostPosted: Tue Jan 30, 2007 12:24 pm    Post subject: Reply with quote

wouldn't disp=(new,delete,delete) work?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Tue Jan 30, 2007 12:50 pm    Post subject: Reply with quote

jyoung wrote:
wouldn't disp=(new,delete,delete) work?


yes it would
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Martin
Beginner


Joined: 20 Mar 2006
Posts: 133
Topics: 58

PostPosted: Tue Jan 30, 2007 1:18 pm    Post subject: Reply with quote

I tried the various option in DISP ... But it doesn't delete it after the execution of the step.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Tue Jan 30, 2007 1:23 pm    Post subject: Reply with quote

Martin wrote:
I tried the various option in DISP ... But it doesn't delete it after the execution of the step.


martin,

Try this

Code:

//STEP0100 EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD *                                             
ABC                                                         
DEF                                                         
//SORTOUT  DD DSN=&&T1,DISP=(NEW,PASS),SPACE=(TRK,(1,1),RLSE)
//SYSIN    DD *                                             
  SORT FIELDS=COPY                                           
/*                                                           
//STEP0200 EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD DSN=&&T1,DISP=(OLD,DELETE)                     
//SORTOUT  DD SYSOUT=*                                       
//SYSIN    DD *                                             
  SORT FIELDS=COPY                                           
/*                                                           
//STEP0300 EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD DSN=&&T1,DISP=(OLD,DELETE)                     
//SORTOUT  DD SYSOUT=*                                       
//SYSIN    DD *                                             
  SORT FIELDS=COPY                                           
/*                                                           


Step0300 will abend with a JCL error as step0200 has already deleted the temp dataset &&t1

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Tue Jan 30, 2007 1:59 pm    Post subject: Reply with quote

sorry, did not read the question close enough; did not realize the temp DS was to be deleted after the step that created it was over.

so, unless you are reading this temp dataset, also, then just make it a DD DUMMY.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Tue Jan 30, 2007 2:13 pm    Post subject: Reply with quote

dbzTHEdinosauer wrote:
sorry, did not read the question close enough; did not realize the temp DS was to be deleted after the step that created it was over.

so, unless you are reading this temp dataset, also, then just make it a DD DUMMY.


Dbz,

you don't have to code DD dummy , even for temp datasets you can specify new,delete and it would delete it after completion of the step.

ex:
Code:

//STEP0100 EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD *                                             
ABC                                                         
DEF                                                         
//SORTOUT  DD DSN=&&T1,DISP=(NEW,DELETE),SPACE=(TRK,(1,1),RLSE)
//SYSIN    DD *                                             
  SORT FIELDS=COPY                                           
/*                                                           
//STEP0200 EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD DSN=&&T1,DISP=(OLD,DELETE)                     
//SORTOUT  DD SYSOUT=*                                       
//SYSIN    DD *                                             
  SORT FIELDS=COPY                                           
/*                         


In this case step0200 will abend with a JCL error as the temp dataset is not found.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Tue Jan 30, 2007 2:51 pm    Post subject: Reply with quote

i suggested dd dummy, because if the temp ds is not being used, why have mvs take the trouble to allocate a ds, etc...............

if this school question is how to delete a temp ds (or any ds) upon completion of the step that creates it, yes you are correct: new, delete,delete.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
Mervyn
Moderator


Joined: 02 Dec 2002
Posts: 415
Topics: 6
Location: Hove, England

PostPosted: Tue Jan 30, 2007 3:30 pm    Post subject: Reply with quote

Or you could just omit the DISP parameter altogether, because the default would be NEW,DELETE,DELETE
_________________
The day you stop learning the dinosaur becomes extinct
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 -> Job Control Language(JCL) 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