by Blackthorn » Tue Apr 15, 2014 3:13 pm
There is no built in function for doing this. I am sure I have heard some talk of it from IBM, so it may be available in a future release but it's not currently.
Two possibilities spring to mind -
1) Get your recovery job to do a PIF enquiry in TWS to find the jobs that are in error. The latest one should be the one that caused your recovery job to be added. Not 100% accurate though - you may get two jobs fail at the same time.
2) Have a common auto recovery job but have them in different applications. That way your failing job would add a unique application to the current plan, and you can then work out what the associated job name is that caused it to be added. Either pass in the Application ID as a variable to your job and have your job cross reference the job name from there, or use JCL variable tables to associate the application that the job is running in with the failed job that added it. That way you could achieve what you want, i.e.; pass failing job name in to your recovery job, but you would need a seperate application for each one and an entry in the JCL variable table. It depends on how many you're talking about doing as to whether you think this is viable.
The other question is whether this is the best way to achieve your goals. Why not use system automation to initiate a job whenever the EQQE036I message is issued to the syslog? That way it would be simple to pass in the failing job name as a paramter.