I have actually coded a Message Rule for this in our Production environment to trap on DSNX881I and create a ticket for our Tier 2 infrastructure team. This message is a multi-line multi-message WTO. It is ugly, indeed. The requirements given to me were to get all of the message text, but strip off the header for every message except the first one. For example, they wanted this.....
DSNX881I =DT02- 20 E 95066 (2016-09-06 20:22:33 UTC) 680
IDAADB2S(10.14.2.250) The replication status for DB2 location DB2S
(subscription DWAB2LDB) is missing, check that the replication
capture agent: is running, has valid credentials, is attached to DB2
and is reachable u
DSNX881I =DT02- 20 E 95066 (2016-09-06 20:22:33 UTC) 681
IDAADB2S(10.14.2.250) nder 10.14.2.129:5999 from the Accelerator
network
to look like this.......
DSNX881I =DT02- 20 E 95066 (2016-09-06 20:22:33 UTC) 680
IDAADB2S(10.14.2.250) The replication status for DB2 location DB2S
(subscription DWAB2LDB) is missing, check that the replication
capture agent: is running, has valid credentials, is attached to DB2
and is reachable under 10.14.2.129:5999 from the Accelerator
network
Notice how the header for the second message has been stripped off?
Here is what I ended up coding:
)MSG DSNX881I MLWTO
)INIT
/*** Setting initial local global variable values that will count the number of lines in the message and the message number itself so you know which DSNX881I messages belong together. ***/
$SET = opsvalue('GLVTEMPL.DSNX881I.LINE_COUNT','U',0)
$SET = opsvalue('GLVTEMPL.DSNX881I.MSG_COUNTER','U',0)
)PROC
/** The only reason I keep a line count is so I know if I am looking for a new DSNX881I message or a continuation. **/
$LINEcount = msg.text.0
$COUNTERval = opsvalue('GLVTEMPL.DSNX881I.MSG_COUNTER','V')
$TOTALline_count = opsvalue('GLVTEMPL.DSNX881I.LINE_COUNT','V')
$MSGcombined = ''
/** NEW MULTI-MESSAGE MLWTO **/
if $TOTALline_count = 0 then
call MESSAGE_NEW
/** CONTINUATION OF MULTI-MESSAGE MLWTO **/
if $TOTALline_count > 0 then
call MESSAGE_CONTINUED
exit
/*** The subroutines start here for either a new DSNX881I message or a continuation of one. ***/
/*** DSNX881I messages are unique based on their Message Counter Number. In the case of your example message, that value is 95066. I also was required trap on the Message Severity value, which in your example is 'E' for "Error". ***/
MESSAGE_NEW:
do a = 1 to $LINEcount
$MSG.a = msg.text.a
if a = 1 then do
parse value $MSG.a with $MSGid $SSID $MSGnbr $MSGsev $MSGcntr $REST
$MSGcombined = $MSGcombined $MSG.a
end /* IF 1st line of the message. */
else
$MSGcombined = $MSGcombined $MSG.a
end /* Loop through every line of the MLWTO. */
if $MSGcntr ¬= $COUNTERval & $MSGsev = 'E' then do
$MSGcombined = strip($MSGcombined)
/*Storing combined message in global variable.*/
$SET = opsvalue('GLVTEMPL.DSNX881I.MSG_COMBINE','U',$MSGcombined)
$SET = opsvalue('GLVTEMPL.DSNX881I.MSG_COUNTER','U',$MSGcntr)
$SET = opsvalue('GLVTEMPL.DSNX881I.LINE_COUNT','U',$LINEcount)
call TICKET
end /* New DSNX881I Error message group. */
return
/*** This Continuation subroutine looks for a match of Message Counter, and the end of the header in the second line and takes everything after it, then adds it to the combined message. ***/
MESSAGE_CONTINUED:
$SAMEmessage = 'NO'
do b = 1 to $LINEcount
$MSG.b = msg.text.b
if b = 1 then do
parse value $MSG.b with $MSGid $SSID $MSGnbr $MSGsev $MSGcntr $REST
end /* IF 1st line of the message. All we need is $MSGcntr. */
if $MSGcntr = $COUNTERval then do
$SAMEmessage = 'YES'
if b = 2 then do
parse value $MSG.b with . ')' $REST
$REST = strip($REST)
$MSGcombined = $MSGcombined $REST
$MSGcombined = strip($MSGcombined)
end /* IF 2nd line of the message. Get rid of what we dont need. */
if b > 2 then do
$MSGcombined = $MSGcombined $MSG.b
end /* IF not the first 2 lines of the message. */
end /* Current Message Counter matches Global Message Counter. */
end /* Loop through every line of the MLWTO. */
/*** This part just adds the continued message to the combined message in the global variable. ***/
if $SAMEmessage = 'YES' then do
$MSGglv = opsvalue('GLVTEMPL.DSNX881I.MSG_COMBINE','V')
$MSGupdate = $MSGglv $MSGcombined
$MSGupdate = strip($MSGupdate)
$SET = opsvalue('GLVTEMPL.DSNX881I.MSG_COMBINE','U',$MSGupdate)
$TOTALline_count = $TOTALline_count + $LINEcount
$SET = opsvalue('GLVTEMPL.DSNX881I.LINE_COUNT','U',$TOTALline_count)
end /* IF this is another message group for combined MLWTOs. */
return
TICKET:
/*** This subroutine is called by the MESSAGE_NEW subroutine and it contains a dynamic rule that waits 5 seconds in order to let the entire combined DSNX881I message text to build, and then it generates the ticket. I did not include the code for this because I did not think it was completely necessary. Let me know if you would like to see it, though. ***/