I have a requirement where in my job (say JOB-B) would run daily (Monday through Friday) and is dependent on another job (say JOB-A)which would generate a daily file and this would be used by JOB-B. I want to pick up one day prior records. i.e. Monday (of JOB-B) should pick up friday's file version (of JOB-A), Tuesday should pick up Monday's file version etc. But the issue is Friday's job (JOB-A)may get delayed for some reason/or may be held and may get delayed
and may run on sat/sun/monday.
If I happen to use two sort cards like
1) To be used for Tuesday through Friday
SORT FIELDS=COPY
INCLUDE COND=(1,5,Y2T,EQ,Y'DATE3'-1)
and
2) Another to be used for Monday
SORT FIELDS=COPY
INCLUDE COND=(1,5,Y2T,EQ,Y'DATE3'-??)
The subtraction digit may be a problem. If it gets delayed by 1 day, I may have to use -2, if delayed by 2 days, I may have to use -3 and so on.So I need to know at run time what should be the subtraction digit and accordingly during scheduling I can pass the sortcard.
So,
1) Is there any way to trace / trap version # of job (JOB-A) when it is loaded in production?
2) If so, is there a way to pass parameter dynamically through DFSORT and use the job version (of JOB-A) when it is loaded in production. This might help as
even though Friday's version gets delayed and runs any time/day, if it runs with particular version, we can do job_version -1
Or another solution is
1) Let first version of job run and then generate a file with date in it and pass this date -1 to the sort everytime it runs next time. But I am unaware how can we pass such parameters?
Yes, we actually need a INCLUDE condition, and GDS will not solve my issue as the input file is collection of historical data and we only need to choose records chanign for a particular day.
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
Would this approach be of use?
Use a GDG of run dates which is created by, say, the last step of your Job-A. This gives the date on which Job-A ran which is typically the Mon-Fri dates.The (-1) of the date GDG is always the last day that Job-A was run, even if it was delayed from Friday to Saturday or Sunday. In normal running Monday's (-1) would point to Friday.
Alternatively, if you only ever need to go back one day, have Job-A record its run-date in a non-GDG .
The input file is a flat file and is in sorted order and I want to retain the order of the file.
I will not be in a position to identify which records are recently added to the output file of JOB-A
Hence GDG won't really help. We need some crtieria through SORT or may be through REXX which can be then used in our JCL,whatever best can be used.
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
I'm not suggesting that your input file be GDG - my suggestion is that you have another file created that contains the date that Job-A was run. You can then use this file in a DFSORT step which dynamically generates the control cards in (new) STEP1 for the DFSORT step in STEP2 which processes your input file - or use SYMNAMES.
If you need to go back more than one day, then having that date file in a GDG would be useful.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
simmimahajan,
The simplest thing to do is to create the Job-B's INCLUDE card in JOB-A itself. So it will create the copy statement and the include cond validating the day of the week it is running
when job-a runs on tuesday thru saturday the subtraction day is set to 1 and on sunday it is set 2 and on monday it is set to 3.
Thanks for your suggestions, I would work on these on Monday and get back to you with the solution chosen. I need to confirm on how many changes can we do to JOB -A as it falls under critical path processing, and minimum changes are expected to this process. Once again thanks, will surely respond you back to your suggestions.
As promised, I am back with the solution devised for this problem. On giving a further thought to this problem and indepth discussion, we found that the schedule date/date when it is loaded on jobtrac can be trapped with some JOBTRAC parameters. Using the JOBTRAC parameter for (List of Symbolic Vars ) we now create a file (basically a parm file containing the desired date). We then use this file as input to SORT along with another file (our actual input file) and use JOINKEYS to get the desired output.