546 Using IBM Application Development Tools for z/OS and OS/390
Fault Analyzer notification user exit
Example A-1 contains the REXX code used by Fault Analyzer to send an e-mail notification to
an application programmer when a production batch job abends.
Example: A-1 Fault Analyzer notification user exit RWAKUP3AM
/* Rexx */
/**********************************************************************/
/* Exec: WakUp3AM */
/* Function: Send an e-mail to notify programmer of application abend */
/* History: 06/15/2001 - LMK - Created */
/* 07/09/2001 - LMK - Modified to use DEST parm of IDIALLOC */
/**********************************************************************/
/* */
/* This exit can optionally be used with IBM Fault Analyzer for */
/* OS/390 to notify application developers of a production batch */
/* abend via e-mail. */
/* */
/* On entry, two stems are provided: */
/* - ENV */
/* - NFY */
/* Both of these data areas are described in the User’s Guide. */
/* */
/* To use this exit, the name of the EXEC (in this example, */
/* WAKUP3AM is used, but this can be any name) must be specified */
/* in an EXITS option as follows: */
/* */
/* EXITS(NOTIFY(REXX((WAKUP3AM))) */
/* */
/* For the exit to be invoked by Fault Analyzer, it must be made */
/* available via the IDIEXEC DDname: */
/* */
/* IDIEXEC(IDI.REXX) */
/* */
/**********************************************************************/
/* Processing:
If a batch job abends on any system other than System A, then:
- Obtain all of the system-level variables and formulate a message
- Get the application ID (3rd field in accounting info)
- Read the Contact list; make sure it is sorted; ignore any comments
- Look up the application and find the person’s name and e-mail id
- Use SMTP to send the message to his/her text pager
/**********************************************************************/
If Env.Job_Type = ‘C’ | ,
Env.System_Name = ‘ASYS’ Then Do
/* You don’t want to process anything from CICS or Sys A */
Exit
End
/*
Establish the environment variables to be used...
*/
SMTPNode = ‘STLADS2C’ /* SMTP gateway NJE node */
SMTPJob = ‘SMTP’ /* SMTP address space */
HostName = ‘US.IBM.COM’ /* Your host name */
Contacts = ‘DEMOS.PDPAK.SAMPLES(CONTACTS)’
Note: This code was written for Introduction to the IBM Problem Determination Tools,
SG24-6296-00. SMTP must be established at the site for this exit to work.
Appendix A. Supporting information 547
/* application contact & problem escalation list */
/* format: appl_name 1st_contact email_id */
/* Note: MUST be a member to avoid enqueues */
/* Remove trailing hex 0’s & convert blanks to special char */
AcctInfo = Strip(Env.Accounting_Info,’T’,’0’x)
AcctInfo = Translate(AcctInfo,”~”,” “)
/* Nibble through each byte to remove hex values */
Do i = 2 to Length(AcctInfo) /* Ignore first hex value */
varChar = Substr(AcctInfo,i,1)
Select
When DataType(varChar,’A’) = 1 Then
Iterate
When varChar = ‘~’ Then
Iterate
When DataType(varChar,’X’) = 0 Then
AcctInfo = Translate(AcctInfo,”,”,varChar)
Otherwise
Nop
End
End
Parse value AcctInfo with . ‘,’ . ‘,’ thisApp ‘,’ .
If thisApp = ‘’ Then
Exit /* Don’t even try to go there without any info */
Parse value Env.Abend_Date with aYear ‘/’ aMonth ‘/’ aDay
abend_date = aMonth’/’aDay’/’aYear /* For the Americans */
/*
Create the body of the e-mail message...
*/
MsgText.0 = 5
MsgText.1 = ‘Batch job ‘Strip(Env.Job_Name)’ abended with’,
‘a return code of’ Env.Abend_Code
MsgText.2 = ‘in program ‘Strip(Env.Abend_Module_Name)’ on’,
abend_date’ at’ Env.Abend_Time’.’
MsgText.3 = ‘It was assigned ‘Strip(Env.Fault_ID)’ in’,
Strip(Nfy.IDIHist)’.
MsgText.4 = ‘Please review this abend immediately.’
MsgText.5 = ‘Call the OpsCenter hot-line at 1-888-123-4567!
/*
Allocate & read the contact list; sort by appl id & ignore comments
*/
IDIAlloc DD(InRead) DSN(“Contacts”) Shr” /* No quotes! */
intRCode = RC
If intRCode > 0 Then Do
“IDIWTO IDIUSR01E”,
“Unable to open Contacts list for”,
Strip(Env.Fault_ID) “failed with RC=”intRCode
Exit
End
Address MVS ,
ExecIO * DiskR InRead (Stem DataLine. Open Finis”
intRCode = RC
If intRCode > 0 Then Do
“IDIWTO IDIUSR02E”,
There was an error reading the Contacts List”,
RC=”intRCode
Exit
End
IDIFree DD(InRead)”
intRCode = RC
Call QSort DataLine.0 /* make sure input is sorted */

Get Using IBM Application Development Tools for z/OS and OS/390 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.