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
2) Another to be used for Monday
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.
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?
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 .
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.
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.