Joined: 27 Oct 2009 Posts: 2442 Location: Netherlands, Amstelveen
dont pm me please. You could have put your pm here :
The question I asked was In OPC, Is there a way to re run a failed job via a BATCH process?
I now you can re run a job from the ISPF interface but this is not what I want. You can also rerun with an OPC RECOVER statement in the JCL but that only gives you one re run and it's instant.
We have some FTP jobs that ocasionaly fail for conection problems & usually a rerun after 2-3 mins works. So I use an MPF exit to trap the failed job and startr an STC to rerun the job in OPC, but there is NO command to do this This is possible on other scheduling platforms.
My response on your pm :
I guess you use system automation (trapping in MPF) if so, you trigger
a rexx in your message table and issue OPCAMOD, OPCAPOST or INGOPC commands within a timer.
see : OPC Automation Programmers Reference" SC33-7046-03
So everybode on this forum can learn from your questions and the answers you get from me and others.
This maybe a little late for the OP, but it's really very easy. The OPC RECOVER statement will do exactly what you require.
Firstly, your assertion that the OPC RECOVER statement only gives you one run is not entirely correct. Sure, it will only give you one rerun per RECOVER statement, as obviously you wouldn't want to continuously resubmit a job that was failing. But if you code multiple RECOVER statements, you will get multiple reruns. TWS will comment out one RECOVER statement on each rerun so it is ignored next time.
As for introducing a delay, the easiest way is to use the ADDPROC statement to add a proc containing a delay program in to your JCL. If you don't have a suitable delay program, use the TWS supplied EQQRETWM. You only need to code this on the first RECOVER statement, so the delay proc only gets added once. Alternatively use the ADDAPPL statement to add in a new application that contains a job running on a "wait" work-station which will be a predecessor to your failed job.
And you could if you wanted to rerun the job via your batch started task initiated from the MPF exit triggered by the failure message, but this all seems horribly compliacated.