Sample code as following:
Sample 1: PGM DCL VAR(&ABNORMAL) TYPE(*CHAR) LEN(1) VALUE('0') STRBKUBRM CTLGRP(DAILYB) SBMJOB(*NO) MONMSG MSGID(CPF0000 BRM0000) EXEC(DO) /* Analyze joblog, retrieve messages, etc to determine exactly what message you got which indicated + that this backup ended abnormally */ CHGVAR &ABNORMAL VALUE('1') ENDDO IF COND(&ABNORMAL<>'1') THEN(DO) /* Backup ended successfully. You could analyze DSPLOGBRM for details */ ENDDO ENDPGM
Sample 2: STRBKUBRM CTLGRP(WEEKLYB) SBMJOB(*NO) MONMSG MSGID(BRM1049) EXEC(GOTO CMDLBL(CONT)) CONT: MONMSG MSGID(BRM10A1) EXEC(GOTO CMDLBL(CONT1)) CONT1: MONMSG MSGID(BRM1820) EXEC(GOTO CMDLBL(CONT2)) CONT2: LOOP: RCVMSG MSGQ(QSYS/QSYSOPR) MSGTYPE(*LAST) RMV(*NO) + MSG(&BRM1049) MSGID(&MSGID) IF COND(&MSGID *EQ 'BRM1049') THEN(DO) SNDSMTPEMM RCP((xxxx@gmail.com)) + SUBJECT('BRMS backup status') + NOTE(&BRM1049) DLYJOB DLY(15) GOTO CMDLBL(DONE) ENDDO GOTO CMDLBL(LOOP)
Reference
- BRMS Messages to Monitor
- BRMS Message
- BRM1049 ==> Control group &1 type &2 processing is complete.
- BRM10A1 ==> Control group &1 type &2 completed with errors.
- BRM1820 ==> Control group &1 type &2 ended abnormally.
- Configuration of the IBM i SMTP Client to Relay Email to Office365 and Gmail
沒有留言:
張貼留言