Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi ! I have a JCL which has two

Status
Not open for further replies.

Idiot

Programmer
Oct 8, 2000
26
0
0
US
Hi !

I have a JCL which has two steps.

STEP1 DELETES OLD FILES
STEP2 EXECUTES A PROGRAM AND CREATES NEW FILES

Due to some reason if STEP2 abends i am ending up with OLD files getting deleted without the new files being created.

Is there any way to control STEP1 execution based on STEP2 return code.
Is it possible in any way to revert back the DELETE of STEP1 based on error from STEP2.

I appreciate any suggestion...

Thanks..
 
It is smart not to delete your files in advance but better rename them to a save file. If step 2 is not succesfull you rename them back on step 3 with condition ONLY.
 
Hi Crox !

How can i rename the files using JCL in Batch?Please furnish me the JCL if you have one handy.

Thanks...

 
It is also possible to have the new files created even if the second step abends, however, the files would obviously not contain all of the relevant data. A backup step is definately the answer. But if you want to keep the new files whether the job abends or not, try coding the disposition as follows:

NEWFILE DD DSN=NEW.OUTPUT.FILE,
DISP=(NEW,CATLG,CATLG),
AVGREC=,
LRECL=

By having the third parm in the DISP statement as CATLG instead of DELETE, you will retain the NEWFILE if an abend should occur.

s-)
 
Hi all,

Better late than never, but a GDG sounds like the best solution here; maybe with a 2 generation limit if you're strapped for DA space, more, if you're not. No need for the first step; use (new,catlg,delete) to keep bad data off the GDG.
 
Hi,

with a job using IKJEFT01 you can give the RENAME statement in TSO. You will have a look-alike job if you run DB2 in the batch without IMS.


 
If the old files are input into step2 have the disposition of these files declared in step2 as (OLD,UNCTLG,KEEP) the new ones would be (NEW,CTLG,DELETE)that way if the step abends the old files will be kept and the new ones will be deleted.
 
Just to add another variety:

First, rename old files;
the exucute, creating new file(s) with the original name(s);
conditional step to delete old files, only if second step executed correctly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top