In a monthly Job I need to include a new JCL step which will delete all the GDG versions created in that particular year. So this new step should run only in December month. How I can trigger this step in december?
Joined: 26 Apr 2004 Posts: 4650 Location: Raleigh, NC, USA
I agree with expat about letting your scheduling system deal with this.
Outside of that, I don't see enough details about how YOU want to do this to really offer much of a recommendation. Obviously, you'll need a program to determine when the current month is equal to 12. Once that's been determined, what is it that you want to happen? Anyway, can't you just handle all of this programatically? Is the extra job step really necessary?
Joined: 22 Apr 2006 Posts: 6258 Location: Mumbai, India
I agree with expat - why not schedule a Job, that's the correct way of doing it.
"in JCL itself", as has been stated many times, is a mis-leading term. JCL is a control language which is used to identify a job to an operating system and to describe the job's requirement and that's it.
On the other hand, if you insist - in the first step of a job, you can check for month-of-the-current-system-date (sort) and based upon that set a RC using which, in next step, execute IDCAMS to delete the GDS in question.
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
Would you want to run it on the Dec 1 or Dec 31? Perhaps there are some process for the year that don't run until Jan? I think there are lot of question that need to be answered and most of them haven't even been asked yet. What about audit requirements?
Relating to your question on executing a jobstep at a specific time of year, I will join the choir telling you to schedule the step in a separate job, or if you insist on having the step inline with other steps in a job then create two versions of the job: One without the delete step and one executed yearly with the delete step. But do let your scheduling software control the execution!
This said, one of the useful things with GDGs is that they can be specified to hold a maximum number of generations. When this number is reached, the lowest generation number is automatically rolled of the GDG, which usually means that the dataset is deleted.
If you want to hold exactly 1 year of monthly datasets, just specify max. generations as 12.
Joined: 31 Mar 2005 Posts: 436 Location: chennai, India
Does your shop accepts #JI card ?
Based on the month and date or the scheduling day, #JI card will be coded before the step and #JEND at the end of the particular step which you wanted to run on particular date/month.
If I am not wrong the below steps can be used to run a step in a particular month.
//STEP0000 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
//SORTOUT DD DSN=&&DATE,
//SYSIN DD *
OUTREC IFTHEN=(WHEN=(7,2,CH,EQ,C'N'), --> Nth day
BUILD=(01:C' SET MAXCC=',5,2,80:X)), --> set the retun code for the respectively if the day is Nth day of the month.
BUILD=(01:C' SET MAXCC=00',80:X)) --> set the return code as 00 for the rest of the days.
//SETMAXCC EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD DSN=&&DATE,DISP=SHR
//JAN EXEC PGM=IEFBR14,COND=(1,NE,SETMAXCC) --> Runs on Nth day of Jan
//FEB EXEC PGM=IEFBR14,COND=(2,NE,SETMAXCC) --> Runs on Nth day of Feb
//MAR EXEC PGM=IEFBR14,COND=(3,NE,SETMAXCC)
//APR EXEC PGM=IEFBR14,COND=(4,NE,SETMAXCC)
//MAY EXEC PGM=IEFBR14,COND=(5,NE,SETMAXCC)
//JUN EXEC PGM=IEFBR14,COND=(6,NE,SETMAXCC)
//JUL EXEC PGM=IEFBR14,COND=(7,NE,SETMAXCC)
//AUG EXEC PGM=IEFBR14,COND=(8,NE,SETMAXCC)
//SEP EXEC PGM=IEFBR14,COND=(9,NE,SETMAXCC)
//OCT EXEC PGM=IEFBR14,COND=(10,NE,SETMAXCC)
//NOV EXEC PGM=IEFBR14,COND=(11,NE,SETMAXCC)
//DEC EXEC PGM=IEFBR14,COND=(12,NE,SETMAXCC)
//NOTNTH EXEC PGM=IEFBR14,COND=(0,NE,SETMAXCC) --> This step will get executed on other days.
You can include the steps you want to execute in the corresponding months.
Joined: 25 May 2007 Posts: 61 Location: Coimbatore
My suggestion is to separate that particular step in to separate job and schedule when ever you want. That could be very straight forward and simple method. You can use IEFBR14 to delete all the generations except GDG Base.
@Dsingh29: I' need to retain the Each months file till december, so the retention period will vary for each file. and also I cannot set LIMIT because I dont want none of previous years data when I'm entering january (new year).