星期五, 10月 27, 2023

How to monitor BRMS command STRBKUBRM backup completed or not ?

 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


沒有留言: