ESP Workload Automation

 View Only
  • 1.  How to achieve below scenario

    Posted Jul 07, 2020 08:38 AM
    We have got a scenario of alert setup where when the job fails first time it should get automatically resubmitted and just send email saying job has been auto restarted. And if the job fails again it has to send email for job failure and ticket has to be generated.

    We already have alert setup for ticket generation when the job fails.

    On 1st failure; RESUB the job and just send alert email  - do NOT generate a ticket

    On 2nd failure; send email and generate a ticket

    Any help on this will be really appreciated.


  • 2.  RE: How to achieve below scenario

    Posted Jul 07, 2020 09:11 AM
    In the CA WA ESP Edition Procedure you can use the MNSUB# Monitor Variable to check how many times the original jobs was submitted.

    Alert Processing Procedure Overview:

    <Send email>

    IF MNSUB# GT 1 THEN <Create Ticket>

    ------------------------------
    Senior Systems Analyst
    UPS
    ------------------------------



  • 3.  RE: How to achieve below scenario

    Posted Jul 07, 2020 01:07 PM
    Thanks for your response and I am already having this alert setup. My concern was with the notification part when the job fails first time it should send email as 'Job has been restarted' and if it fails again it should send email as 'Job has been failed'. 

    So when I notify statement at alert level it is not working and is there any other way to achieve that?


  • 4.  RE: How to achieve below scenario

    Broadcom Employee
    Posted Jul 07, 2020 01:19 PM
    Hi, 
    Very similar to Rick's response.  I will add a little more detail. 

    When the job fails, the ALERT triggers and builds the appl.
    In that appl Rick suggested adding the line  
    IF MNSUB# GT 1 THEN <Create Ticket>

    There are variations
    IF MNSUB# EQ 1 THEN <send E-Mail>

    I since there may be multiple lines to <send E-Mail> it may look like the one below. 

    IF MNSUB# EQ 1 THEN DO
      JOB MAIL
         RUN ANY
       ENDJOB
    ENDDO

    There are multiple ways to send an E-Mail.  Above is the simple case to run a piece of JCL.  The person/group can be passed into the JCL as a variable. Another possibility is to run a script on a Unix server. 

    2¢ 
    Don
     





  • 5.  RE: How to achieve below scenario

    Posted Jul 13, 2020 11:31 AM
    Will this coding works to achieve my condition? If I use ESPREEXEC will the job gets re-executed only if it gets failed or even on successful run will my job gets resubmitted?


    JOB TESTJOB1
    RUN NOW
    IF %ESPREEXEC#=0 THEN DO
    REEXEC IN(1)
    ENDDO
    ELSE -
    NOTIFY FAILURE MAILBOX(XXXXX) +
    SUBJECT('JOB FAILED AFTER RESTART')
    ENDJOB


  • 6.  RE: How to achieve below scenario

    Posted Jul 13, 2020 01:12 PM
    Suggested Updates

    TESTAPPL : ESPPROC
    APPL TESTAPPL


    JOB TESTJOB1
    RUN NOW
    /* Only one NOTIFY statement in main job */
    NOTIFY FAILURE ALERT(RSEB) --> Invokes Alert Processing when job fails
    ENDJOB


    Alert Definition (Determines what jobs to run)

    RSEB : ESPPROC
    APPL RSEB


    /* First Failure - resubmit job and send email */
    /* Second Failure - send email, create ticket  */

    IF MNSUB# EQ 1 THEN DO  
       JOB FAIL_ONE TASK SELFCOMPLETING
         RUN ANYDAY
         ESPNOMSG AJ %MNJOB APPL(%MNAPPL..%MNAPPLGEN)
         NOTIFY MAILBOX(<Valid Mailbox) JOBEND
       ENDJOB
    ENDDO
    ELSE DO
       JOB FAIL_TWO TASK SELFCOMPLETING
         RUN ANYDAY
         NOTIFY MAILBOX(<Mailbox ID>) JOBEND     /* Enter valid MAILBOX ID */ 
         RELEASE CREATTIX
       ENDJOB
      JOB CREATTIX
        RUN ANYDAY
       ENDJOB
    ENDDO



    ------------------------------
    Senior Systems Analyst
    UPS
    ------------------------------



  • 7.  RE: How to achieve below scenario

    Posted Jul 07, 2020 01:25 PM

    Please post the PROC/APPL that contains the Job in question and the Alert Processing Procedure



    ------------------------------
    Senior Systems Analyst
    UPS
    ------------------------------



  • 8.  RE: How to achieve below scenario

    Posted Jul 13, 2020 04:47 AM
    Hi Rick,

    Kindly find the requested information below.

    TESTAPPL : ESPPROC
    APPL TESTAPPL 


    JOB TESTJOB1 
    RUN NOW
    NOTIFY FAILURE ALERT(FAIL)   ---> Alert that creates ticket for job failure
    NOTIFY FAILURE ALERT(RSEB)  --> Alert created for automatic re submission of job on failure
    ENDJOB

    Alert Definition:

    RSEB : ESPPROC
    APPL RSEB

    IF MNSUB# LE 1 THEN -
    ESPNOMSG AJ %MNJOB RESUB APPL(%MNAPPL..%MNAPPLGEN)