MainframeSupports
tip week 22/2004:

I am not very good at OPC so this tip is a dedication from Søren Stenlund Jensen, one of my loyal readers. He is not very fond of OPC (like me), but the RECOVER function is worth a tip in his opinion, mainly because he and I think that only a few people knows about it.

The RECOVER function in OPC has a lot of functionality so I will try to cover only a few of the possibilities. Basically RECOVER can restart a job one or more times and it is also possible to start other jobs if a job fails. To activate OPC RECOVER the job has to be started by OPC and the job must include a comment located after the JOB card and before the first EXEC card. The comment has to look a lot like this:

//*%OPC RECOVER JOBCODE=<returncode>,RESTART=Y,ADDAPPL=<OPC-appl-name>

The returncode must be the return code that should trigger the RECOVER action. As an example you can use JOBCODE=S*37 which will trigger for all S*37 abend types. The parameter RESTART=Y will restart the job from the top and the parameter ADDAPPL=<OPC-appl-name> will ADD the OPC application OPC-appl-name to the current plan and start it right away. The restart of the current job will be postponed until the ADD'ed OPC application completes.

If ADDAPPL is omitted the restart will occur immediately. RESTART=N without ADDAPPL will not trigger any RECOVER action at all and normal OPC error action will take place. RESTART=N with ADDAPPL will start the named OPC application and the job triggering this event will be placed on the OPC error queue just like it would have been without any RECOVER triggering. The triggered OPC application can complete the triggering job if you design it to do so.

If you want a job to be able to restart more than once then you just have to repeat the RECOVER comment the number of times you want restart to happen.The following example will restart the job three times if it fails three times with a return code of 20. If any other bad return code is received the job will be placed on the error queue. If the job terminates normally it will get a status of completed in OPC, but if the job fails with a return code of 20 a fourth time then it will be placed on the error queue:

//*%OPC RECOVER JOBCODE=20,RESTART=Y
//*%OPC RECOVER JOBCODE=20,RESTART=Y
//*%OPC RECOVER JOBCODE=20,RESTART=Y

I have found an old bookshelf with OPC version 2 release 2 on. The bookshelf is from 1998 so it is not for the newest version of OPC (I hope). Here you can read more about the OPC RECOVER function. Maybe you can obtain a newer version of the manuals using Book Manager on your mainframe. Bookshelves about OPC starts with EQQ.

Previous tip in english        Sidste danske tip        Tip list