ESP Workload Automation

  • 1.  Coding IF Statements question

    Posted Oct 31, 2018 03:00 PM

    Coming from high level coding languages, I am looking to something like this:

     

    IF ESPAPSUB# < 5 and stepA return code = x or y, THEN +

     

     

    Is this possible? I have a user that has known error codes pop up due to FTP, and is trying to prevent ticket creation due to failure buy specific condition codes. If those codes are reached, she is looking to have the job resubmit itself up to 5 times, waiting 5 minutes each time. I have a similar event that does the resubmit up to 5 times, waiting 5 minutes each time, but I don't care about each failure until the final fail, which sends me an email. She is getting a ticket each time the event fails, which could be up to 6 times, which she does not want until the final failure if that happens.

     

    Thanks,

     

    Frank



  • 2.  Re: Coding IF Statements question

    Posted Oct 31, 2018 03:22 PM

    Hi Frank, 

    I think I would use an alert to trigger on the failure. Then use the code you provided to determine whether to page or restart. 

    The appl that is triggered by the alert would contain something like 

    IF ESPAPSUB# < 5 and %MNMXCMPC > 0 THEN DO

       Notify job here

    ENDDO

     

    I will mention that I don't like having the failed job out there for 30 minutes during retries. Sooner or later someone is going to take action on that failed job and restart it or call someone. I think it is cleaner (but more complex) to have it complete successfully (even though it failed) and restart the job after a delay. This gets tricky having the remainder of the cycle wait for the real successful of the job.  I have some code that I could attach if you are interested. I would need to review it first. I have several different flavors of this.... 

     



  • 3.  Re: Coding IF Statements question
    Best Answer

    Posted Oct 31, 2018 03:30 PM

    Sounds similar to what I am doing now:

     

    JOB DXVRAEX2
      IF ESPAPSUB# < 5 THEN +
         DO
              NOTIFY FAILURE EVENT(DXRACF.VRA_DAILY_ALERT) +
                 MAILBOX(SECURITY)
         ENDDO
      ELSE +
         DO
              NOTIFY FAILURE MAILBOX(SECURITY) +
                 SUBJECT('DXVRADB2 MAXIMUM RESUBMISSIONS')
         ENDDO
       RUN ANY
       RELEASE (DXVDBFTP)
    ENDJOB

     

    VRA_DAILY_ALERT ends up kicking this off:
    /* FIRST TIME HERE WE SIMPLY WAIT FIVE MINUTE */
    /* SECOND TIME HERE AFTER THE REEXEC WE RESUBMIT THE JOB */
    IF ESPREEXEC#=0  THEN +
        DO
           REEXEC IN(5)
        ENDDO
    ELSE +
        DO
           ESP APPLJOB %MNFULLNAME RESUB APPL(%MNAPPL..%MNAPPLGEN)
        ENDDO

     

    The problem is that that for my user, if it fails on any attempt, a ticket is generated, so it sounds like she is wanting to prevent anything from failing until after trying 5 times. Not sure if that is entirely possible.



  • 4.  Re: Coding IF Statements question

    Posted Oct 31, 2018 03:42 PM

    Hi Frank, 

    NOTE:

    This "NOTIFY FAILURE EVENT(DXRACF.VRA_DAILY_ALERT)" runs when the ESPAPSUB# is < 5. This looks like the one for the failure...The one for 5+ "NOTIFY FAILURE MAILBOX(SECURITY) " only sends a message.  You may know different. 

     

    SECOND NOTE:

    I usually separate the IF into a second appl that is triggered so I am not sure the behavior of this. Let me know if the issue is not resolved by the above comment. 

     



  • 5.  Re: Coding IF Statements question

    Posted Oct 31, 2018 03:47 PM

    Hi Frank, 

    I think I hit enter too quick..... 

    In this case you are saying that it is doing both NOTIFY statements each time? 

    I will have to play with that. 



  • 6.  Re: Coding IF Statements question

    Posted Oct 31, 2018 04:21 PM

    Currently it will notify 5 times with the first notify statement (if it fails all those times) and then will notify with the second statement (after having failed 5 times up top)

     

    This code works as I intend it, but is the only example I have for my user looking to keep the job from failing until it has been attempted 5 times



  • 7.  Re: Coding IF Statements question

    Posted Nov 02, 2018 09:01 AM

    HI Frank, 

    I came up with this. Let me know if this does not meet your needs.  The job fails and a status is set that it will "Restart in 1 minute". It will restart 4 times then other NOTIFY will kick in and go through the real FAIL process and page someone.... 

     

    This is the job. 

    UNIX_JOB DPTEMP
        RUN ANY
        IF ESPAPSUB# <5 THEN NOTIFY JOBEND EVENT(POWDO03.RSUB)
        IF ESPAPSUB# >=5 THEN NOTIFY FAILURE EVENT(POWDO03.FAIL)
        AGENT agentu_01
        USER espadmin
        SCRIPTNAME /opt/scripts/testscripts/sleep.sh
        ARGS 6 5
        RELEASE (DPTEMP.002)
    ENDJOB

     

    This is the contents of the RSUB APPL

    APPL RSUB

    ESPNOMSG MGRMSG * . . . %MNFULLNAME/%MNAPPL..%MNAPPLGEN/MAIN +
    STATE FAILED Status('RESUB IN 1 MINUTE')

    JOB LINK2 LINK PROCESS
        RUN ANY
        RELDELAY 1
        IF %MNCMPC > 0 THEN DO
            ESP APPLJOB %MNFULLNAME RESUB APPL(%MNAPPL..%MNAPPLGEN)
        ENDDO
    ENDJOB



  • 8.  Re: Coding IF Statements question

    Posted Nov 02, 2018 12:15 PM

    Thank you, I will give this to my user and see what we can do for them. I appreciate the help, and will update with the result.



  • 9.  Re: Coding IF Statements question

    Broadcom Employee
    Posted Nov 09, 2018 12:58 PM

    Hi Frank,

     

    Have you tried as suggested by Don? Does it work well?

     

    Thank you for your update,

     

    Lucy



  • 10.  Re: Coding IF Statements question

    Posted Jan 31, 2019 02:28 PM

    I handed the solution off to the user. I reached out and they decided to go a different direction. Go figure! At least I have this in my back pocket for next time.

     

    Thanks!