Suggested UpdatesTESTAPPL : 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
------------------------------
Original Message:
Sent: 07-13-2020 11:31 AM
From: Sujeeth Kumar
Subject: How to achieve below scenario
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
Original Message:
Sent: 07-07-2020 01:19 PM
From: Don Powell
Subject: How to achieve below scenario
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
Original Message:
Sent: 07-07-2020 01:06 PM
From: Sujeeth Kumar
Subject: How to achieve below scenario
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?
Original Message:
Sent: 07-07-2020 09:10 AM
From: Rick Romanowski
Subject: How to achieve below scenario
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
Original Message:
Sent: 07-07-2020 08:38 AM
From: Sujeeth Kumar
Subject: How to achieve below scenario
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.