How can you instruct Control-M to perform a shout after 'x' failures of a job?

Version 1
    Share This:

    This document contains official content from the BMC Software Knowledge Base. It is automatically updated when the knowledge article is modified.


    Control-M/Enterprise Manager


    Control-M/Enterprise Manager



    When our job fails it is automatically rerun via a DO RERUN statement, but after the job has been rerun 3 times we would like Control-M to send a shout/mail message, instead of issuing it every time the job fails.


    Applies To

    Control-M/Enterprise Manager

    Control-M/Server for Unix and Microsoft Windows



    Legacy ID:KA286938




    In Control-M version 8 a new parameter for DO statement : "Job's number of failures" has been introduced. An action can be added when the parameter reach a wanted value.


    For versions prior than Control-M version 8 one of the following workarounds can be used:


    Workaround 1)


    Choose Job Editing Form -> register "Steps"


    - Add following statement


       ON stmt=* code= RUNCOUNT>3


       DO SHOUT


    Workaround 2)


    It is not possible to do this from one job, so a second monitor job is needed. Every time the first job fails it sets the value of a global autoedit variable to the order id of the failed job. The second job references the global autoedit variable and then checks the number of times the job has run using the command. 


    For Unix run:

           ctmpsm -LISTJOB NOTOK | grep %%PARM1 | grep ' 4 '

    For Windows run:

           ctmpsm -LISTJOB NOTOK | grep %%PARM1 | find " 4 "



    where 4 indicates that the job has been rerun 3 times. 


    When the monitor job ends with a return code of 0 then it has determined that the job has been rerun 3 times and will can send an appropriate shout/mail message. 


    In the attached draft the above command was run from a batch script, but it could be run as a command.


    If using this solution on more than one job then it will be necessary to ensure the name of the global autoedit variable name is unique for each monitored job.


    Article Number:


    Article Type:


      Looking for additional information?    Search BMC Support  or  Browse Knowledge Articles