Page 1 of 2

Job Deletion.

PostPosted: Wed Dec 10, 2014 7:35 pm
by Vineet
Hi All,
I have a query. I am running a job. is there a way, that in the same job I delete the same member. Below is example.

For Example: A.B.C(JOB1). In the member JOB1, I want to add a last step to Delete the member JOB1 i.e. after execution of the job in the PDS => A.B.C member JOB1 should get deleted after the execution of job JOB1.

Thanks

Re: Job Deletion.

PostPosted: Wed Dec 10, 2014 8:23 pm
by enrico-sorichetti
You can delete it in any step even the first one
the dataset containing the JCL will be used only for the tiny instant needed by jets to write it to the SPOOL
when You get the message JOB submitted the job will be in the mighty hands of JES and the dataset can be deleted

thats what happens when submitting something within ispf edit/view/browse,
the edit/view/browse windows data is copied to a ISPF work dataset,
and after the submit the dataset will be reused for other things

Re: Job Deletion.

PostPosted: Wed Dec 10, 2014 8:26 pm
by vern
Yes you can, easily. Add a step to delete A.B.C(JOB1) using IDCAMS or TSO DELETE.

However, I guess what you mean but didn't say, is that you want something that works dynamically instead of hardcoded, i.e. the same process works for A.B.C(JOB2) and B.C.D(JOB3) and so on. Correct?

Re: Job Deletion.

PostPosted: Wed Dec 10, 2014 8:45 pm
by Vineet
Hi Vern,
My requirement is I want to perfom the DELETE activity when I am running the same job. For example If I am running job "JOB1". I need to add Step @ end to Delete the job 'JOB1'. Afer execution of JOB1 there should not be any Job with Name JOB1 in the PDS: A.B.C(*) for exapmple. By executing IDCAMS utility seperately I can delete JOB1. I don't want this.

Thanks

Re: Job Deletion.

PostPosted: Wed Dec 10, 2014 8:54 pm
by Terry Heinze
Caution: I haven't tested IDCAMS or TSO DELETE, but DO NOT USE IEFBR14 for the delete, because your entire PDS will be deleted, not just the one member.
P.S. I used the INTRDR as the last step in the 1st job. It submitted the delete job.

Re: Job Deletion.

PostPosted: Wed Dec 10, 2014 8:59 pm
by Vineet
Is there a way using JCL we can close any PDS?

Re: Job Deletion.

PostPosted: Wed Dec 10, 2014 9:34 pm
by vern
Vinnet, let's try again: so you want to delete the member JOB1 in A.B.C, but you don't want to add a step to the JCL of JOB1 to do this. You want "something else" to delete the member when the job has completed processing. Is this right ?

Re: Job Deletion.

PostPosted: Wed Dec 10, 2014 9:36 pm
by vern
And no, there is no way of closing a PDS using JCL. The user/job which has opened the PDS (or any other type of dataset) must close and release it.

Re: Job Deletion.

PostPosted: Wed Dec 10, 2014 9:56 pm
by Vineet
Hi Vern,
Let me try to explain U my requirement.

1. I am having a job 'JOB1' in PDS A.B.C(JOB1)'.
2. I want to add a step @ the end of JOB1, so that when the Step executes in JOB1, should delete the Member JOB1 from the PDS A.B.C(*).
3. Tried using IDCAM, but job error out with message 'member in use'.

OR is there a way to Close the member JOB1, by running the JOB1.

If any query/concern please do let me know.

Rgd's

Re: Job Deletion.

PostPosted: Wed Dec 10, 2014 10:18 pm
by steve-myers
What about -
//DELJOB  EXEC PGM=IKJEFT01,PARM='DELETE ''A.B.C(JOB1)'''
//SYSTSPRT DD  SYSOUT=*
//HOLDDS   DD  DISP=OLD,DSN=A.B.C
//SYSTSIN  DD  DUMMY
The HOLDDS DD statement will prevent the job from running until everyone has released A.B.C, though that may not be desirable.