View previous topic :: View next topic |
Author |
Message |
Martin Beginner
Joined: 20 Mar 2006 Posts: 133 Topics: 58
|
Posted: Tue Jan 30, 2007 5:43 am Post subject: Temp dataset deletion |
|
|
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 |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Tue Jan 30, 2007 7:27 am Post subject: |
|
|
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 |
|
|
jyoung Beginner
Joined: 10 Nov 2005 Posts: 36 Topics: 2 Location: Flint, MI
|
Posted: Tue Jan 30, 2007 12:24 pm Post subject: |
|
|
wouldn't disp=(new,delete,delete) work? |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Tue Jan 30, 2007 12:50 pm Post subject: |
|
|
jyoung wrote: | wouldn't disp=(new,delete,delete) work? |
yes it would _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
Martin Beginner
Joined: 20 Mar 2006 Posts: 133 Topics: 58
|
Posted: Tue Jan 30, 2007 1:18 pm Post subject: |
|
|
I tried the various option in DISP ... But it doesn't delete it after the execution of the step. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Tue Jan 30, 2007 1:23 pm Post subject: |
|
|
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 |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Tue Jan 30, 2007 1:59 pm Post subject: |
|
|
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Tue Jan 30, 2007 2:13 pm Post subject: |
|
|
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 |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Tue Jan 30, 2007 2:51 pm Post subject: |
|
|
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 |
|
|
Mervyn Moderator
Joined: 02 Dec 2002 Posts: 415 Topics: 6 Location: Hove, England
|
Posted: Tue Jan 30, 2007 3:30 pm Post subject: |
|
|
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 |
|
|
|
|