Hi there, I have created a CLP (I’m not really good at CL) that will run on request via scheduler after a backup has completed. It will check through the Hist Log looking for specific failure msgs. If it finds them it should email oncall support. Not sure if there is a better way to do it but I have pasted the CLP below. So on a normal day it should not find any error msgs – and the DSPLOG cmd should throw a CPF2447 (which I am montoring for) but this does not seem to have the desired result.
I’d appreciate any alternative ideas, on how to achieve a similar result, no matter how complex.
PGM
DCL VAR(&TODAY) TYPE(*CHAR) LEN(6) /*CURRENT JOB DATE*/
DCL VAR(&TODAYJ) TYPE(*CHAR) LEN(7) /* JULIAN FMT */
DCL VAR(&ONEDAYDEC) TYPE(*DEC) LEN(7 0) /* – 1 D*/
DCL VAR(&ONEDAYJ) TYPE(*CHAR) LEN(7) /* – 1 DAY JUL*/
DCL VAR(&TODAYDEC) TYPE(*DEC) LEN(7 0) /*TODAY DEC*/
DCL VAR(&MINONEDAY) TYPE(*CHAR) LEN(6)
DCL VAR(&NUMBER) TYPE(*CHAR) LEN(6) /*JOB NUMBER*/
DCL VAR(&JOB) TYPE(*CHAR) LEN(10) /* JOB */
DCL VAR(&USER) TYPE(*CHAR) LEN(10) /*USER OF JOB */
DCL VAR(&DAY) TYPE(*CHAR) LEN(4) /*DAY OF WEEK*/
/* RETRIEVE CURRENT DATE*/
RTVJOBA DATE(&TODAY) DAYOFWEEK(&DAY)
/* RETRIEVE CURRENT JOB NUMBER */
RTVJOBA JOB(&JOB) USER(&USER) NBR(&NUMBER)
/*CONVERT TO JULIAN DATE*/
CVTDAT DATE(&TODAY) TOVAR(&TODAYJ) TOFMT(*LONGJUL) +
TOSEP(*NONE)
/*CHANGE TO DECIMAL*/
CHGVAR VAR(&TODAYDEC) VALUE(&TODAYJ)
/* SUBTRACT 1 WK*/
CHGVAR VAR(&ONEDAYDEC) VALUE(&TODAYDEC – 1)
/*CHANGE BACK TO CHAR JUL*/
CHGVAR VAR(&ONEDAYJ) VALUE(&ONEDAYDEC)
/*CONVERT BACK TO DMY FORMAT*/
CVTDAT DATE(&ONEDAYJ) TOVAR(&MINONEDAY) FROMFMT(*LONGJUL) +
TOFMT(*DMY) TOSEP(*NONE)
DAYTEST: IF COND(&DAY *EQ ‘*SUN’) THEN(GOTO CMDLBL(BACKUPBADW))
ELSE CMD(IF COND(&DAY *NE ‘*SUN’) THEN(GOTO +
CMDLBL
(BACKUPBADD)))
/* search for error conditions */
BACKUPBADW: DSPLOG PERIOD((’18:00:00′ &MINONEDAY)) OUTPUT(*PRINT) +
MSGID(BRM1646 BRM2265 BRM3D1D CPFB8C4 BRM1820 +
CPF3794 BRM1033 BRM1484 CPF3763 CPC2402 BRM2259
+
CPF3795 CPF3808
)
MONMSG MSGID(CPF2447) EXEC(GOTO CMDLBL(BACKUPGOOD))
BADEMAIL: SNDDST TYPE(*LMSG) +
TOINTNET((IT_Systems_Administrators@company.com +
*PRI) (oncall@supbackup1.company.com *PRI)) +
DSTD(EMAIL) LONGMSG(‘There are errors in the +
Qsupas2 Backup Report. Please review the backup
+
report for further details & rerun the backups
+
if required.’
) SUBJECT(‘QSUPAS2 BACKUPS FAILED’)
GOTO CMDLBL(END)
BACKUPBADD: DSPLOG PERIOD((’18:00:00′ &MINONEDAY)) OUTPUT(*PRINT) +
MSGID(BRM1646 BRM2265 BRM3D1D CPFB8C4 BRM1820 +
CPF3794 BRM1033 BRM1484 CPF3763 CPC2402 BRM2259
+
CPF3795 CPF3808
)
MONMSG MSGID(CPF2447) EXEC(GOTO CMDLBL(BACKUPGOOD))
BADEMAILD: SNDDST TYPE(*LMSG) +
TOINTNET((IT_Systems_Administrators@company.com +
*PRI) (IT_Operations@company.com *PRI)) +
DSTD(EMAIL) LONGMSG(‘There are errors in the +
Qsupas2 Backup Report. Please review the backup
+
report for further details & rerun the backups
+
if required.’
) SUBJECT(‘QSUPAS2 BACKUPS FAILED’)
GOTO CMDLBL(END)
BACKUPGOOD: DSPLOG PERIOD((’18:00:00′ &MINONEDAY)) OUTPUT(*PRINT) +
MSGID(CPF3700 CPC1236 CPC3722 CPC3736 CPC3732 +
CPC3721 CPC3837 BRM1049 BRM1380 BRM1058 BRM1683
+
BRM1454 CPF3800 CPF9800 BRM14A1 BRM10A1 CPFB8ED
+
CPFA0DC CPFA0DB CPF5729 CPFB8ED OPT1332 BRM1484
)
GOODEMAIL: SNDDST TYPE(*LMSG) +
TOINTNET((IT_Systems_Administrators@company.com +
*PRI) (IT_Operations@company.com *PRI)) +
DSTD(EMAIL) LONGMSG(‘The Qsupas2 Backup Report +
has been run. There are no major errors
+
reported. Please review the backup report for
+
further details.’
) SUBJECT(‘Qsupas2 Backups +
Successfull’
)
END: ENDPGM
The post Automate iSeries Backup Checking using CLP appeared first on IT Answers.