Thomas_Kelly_9542

Attaching a failed job's report to a notification email

Discussion created by Thomas_Kelly_9542 on Aug 1, 2017
Latest reply on Aug 3, 2017 by LeonardOlteanu
Hi folks,

I'm working on updating our email notification script to include a bit more information and I'm stuck on how to export the full job report from a failed job to get it into the email notification. Ideally, I'd like for it to export and attach as a .txt file. I've tried using PREP_PROCESS_REPORT, but can't work myself through how to use it correctly. 

Here's what I have set up right now. Any tips or assistance would be appreciated!

!-- Call Operator Script
:SET &DATE = SYS_DATE('MM/DD/YYYY')
:SET &TIME = SYS_TIME('HH:MM')
!--
:SET &P_NAME = GET_PARENT_NAME(,,'ACT')
:SET &P_NR   = GET_PARENT_NR(,,'ACT')
!--
:READ &UC_CAUSE_NAME,,
:READ &UC_CAUSE_NR,,
:READ &UC_CAUSE_RETCODE,,
!--
:SET &UC_CAUSE_RETCODE = FORMAT(&UC_CAUSE_RETCODE)
!--
:SET &MSG = 'Error in Job Plan &p_name (RUN: &p_nr) Job that failed and caused the error '
:SET &MSG = STR_CAT(&MSG, 'was &UC_CAUSE_NAME (RUN: &UC_CAUSE_NR) Returncode: ')
:SET &MSG = STR_CAT(&MSG, '&UC_CAUSE_RETCODE, Error occured on &date at &time')
!--
:set &email_to  = get_var(EMAIL_RECIPIENTS_ABENDS,'&UC_CAUSE_NAME')
:if &email_to <> ''
:  set &return    = send_mail('&email_to',,'&UC_CAUSE_NAME - Failed ','&MSG',)
:  print &return
:endif
:STOP NOMSG
!-- End Call Operator Script

Outcomes