IBM i Global

IBM i Global

Connect, learn, share, and engage with IBM Power.

 View Only
Expand all | Collapse all

BRMS MSGID Monitoring : CLP

Paul Hemeleers

Paul HemeleersMon October 16, 2023 03:27 AM

  • 1.  BRMS MSGID Monitoring : CLP

    Posted Fri October 13, 2023 04:56 PM
    Edited by Avinash Chandra Mandavilli Mon October 16, 2023 02:56 PM

    Hello IBM Programmers ,

    First of all , i would like to say that I'm not super good in programming skills 

    Anyways, I would like to call the control group from CLP and monitor this BRMS message ID ( BRM1049 ) while backup is running, if the following MSGID picks , i should get alerted to my inbox. Unfortunately the program is not getting created because of this warning 30 error . Incase if my program is incorrect . Please provide your 2cents of guidance :) . Appreciate your help.

    MONMSG MSGID(BRM1049) EXEC(DO) 

    *CPD0896 30 Messages Cannot be monitored on this command 

    Sample Program :

    PGM
    DCL VAR(&BRM1049) TYPE(*CHAR) LEN(80)
    DCL VAR(&BRM4116) TYPE(*CHAR) LEN(80)
    DCL VAR(&BRM10A1) TYPE(*CHAR) LEN(80)
    DCL VAR(&BRM1820) TYPE(*CHAR) LEN(80)
    CHGVAR VAR(&BRM1049) VALUE('Control group DAILYB type *BKU processing is complete')        
                                           
    STRBKUBRM  CTLGRP(DAILYB) SBMJOB(*YES)

    MONMSG MSGID(BRM1049) EXEC(DO) 
    SNDDST TYPE(*LMSG) TOINTNET((abcd@gmail.com)) DSTD('&BRM1049') MSG(&BRM1049) LONGMSG(&BRM1049) SUBJECT(&BRM1049)                                                                                                                 
    ENDDO 
    GOTO       CMDLBL(DONE) 

    DONE:                                                                      
    ENDPGM 



    ------------------------------
    Avinash Chandra Mandavilli
    ------------------------------



  • 2.  RE: BRMS MSGID Monitoring : CLP

    Posted Mon October 16, 2023 03:27 AM

    Hi ,

    I should use this pgm :

    PGM                                                                           
      DCL VAR(&BRM1049) TYPE(*CHAR) LEN(80)                                       
      DCL VAR(&BRM4116) TYPE(*CHAR) LEN(80)                                       
      DCL VAR(&BRM10A1) TYPE(*CHAR) LEN(80)                                       
      DCL VAR(&BRM1820) TYPE(*CHAR) LEN(80)                                       
      CHGVAR VAR(&BRM1049) VALUE('CONTROL GROUP DAILYB TYPE *BKU PROCESSING IS +  
      COMPLETE')                                                                  
                                                                                  
      STRBKUBRM  CTLGRP(DAILYB) SBMJOB(*YES)                                      
                                                                                  
      MONMSG MSGID(BRM1049) EXEC(DO)                                              
                 SNDDST     TYPE(*LMSG) +                                         
                              TOINTNET((XXXX.YYYYYYYYY@SSSSSSSS.com)) +           
                              DSTD('&BRM1049') MSG(&BRM1049) +                    
                              LONGMSG(&BRM1049) SUBJECT(&BRM1049)                 
      ENDDO                                                                       
      GOTO       CMDLBL(DONE)                                                     
     DONE:       ENDPGM                                                           



    ------------------------------
    Paul Hemeleers
    ------------------------------



  • 3.  RE: BRMS MSGID Monitoring : CLP

    Posted Mon October 16, 2023 02:46 PM

    Hello Paul,

    Thank you for your post. I think BRMS message ids cannot be monitored with CLP. can you pls let me know if there is any alternative way 

    In Help Systems and IBM sites, below statement has been stated that BRMS control group can be called with CLP and monitor for these errors with MONMSG. 

    <<Sometimes it may be advantageous to monitor for these errors. One solution is to call the control group from within a CL routine and then MONSG for this error(s) in this way. This CLP will have all the commands in it and then you have the ability to monitor for messages/failures. We do NOT recommend running save commands in a control group *EXIT but you can run a control group within a CLP>>

     



    ------------------------------
    Avinash Chandra Mandavilli
    ------------------------------



  • 4.  RE: BRMS MSGID Monitoring : CLP

    Posted Mon October 16, 2023 04:45 AM

    Hello Avinash,

    The good news is that you do not need any program skill for what you want.

    The maybe ba news is that you need to purchase the BRMS Network feature (5770-BR1) for getting done what you want. 

    This feature will allow you to mail any message present in the BRMS log real time. If you have more than one system in a BRMS network with an SMTP Serber running, you are even able to get this done when running in restricted state.

    For documentation, please have. a look here: 

    https://helpsystemswiki.atlassian.net/wiki/spaces/IWT/pages/888963080/BRMS+SQL+Services

    Look at the section => BRMS Log Services. 
    In there you will find:
    QUSRBRM.BRMS_DISTRIBUTION_MESSAGES 
    QUSRBRM.SET_BRMS_DISTRIBUTION_SERVER
    QUSRBRM.ADD_BRMS_DISTRIBUTION_MESSAGE 
    QUSRBRM.ADD_BRMS_DISTRIBUTION_MESSAGE

    If you want messaging to be working in real-time you have to add an additional server with SMTP working there and also you have to start an IP interface when running your restricted (Full) System save. 

    Good luck with implementing this great feature, without the need to write CL.

    Greetings 



    ------------------------------
    Rudi Van Helvoirt
    ------------------------------



  • 5.  RE: BRMS MSGID Monitoring : CLP

    Posted Mon October 16, 2023 07:25 AM

    Hello Paul,

    first of all best thanks for the information.
    Unfortunately, errors have crept into the examples for the procedure QUSRBRM.SET_BRMS_DISTRIBUTION_SERVER:
    call QUSRBRM.SET_BRMS_DISTRIBUTION_SERVER('APPN.PRIMARY', 'none', 'myemail@company.com').
    The commas between the parameters for the procedure should not be there. Properly the call should look like this:call QUSRBRM.SET_BRMS_DISTRIBUTION_SERVER('APPN.PRIMARY' 'none' 'myemail@company.com').

    Best regards
    Thomas



    ------------------------------
    Thomas Goetze
    ------------------------------



  • 6.  RE: BRMS MSGID Monitoring : CLP

    Posted Mon October 16, 2023 02:44 PM

    Hello Rudi,

    I've already aware of this call command feature. Infact, I'd already implemented with below sample commands. When the control group backup is completed. I'm not getting any notification. After 24hrs I receive a delay delivery message as shown below. Also, don't we get the subject line as <<BRM1049: Control group *BKU completed normally >> 

    call QUSRBRM.SET_BRMS_DISTRIBUTION_SERVER('LOCAL', 'none', 'abcd@gmail.com')

    call QUSRBRM.ADD_BRMS_DISTRIBUTION_MESSAGE('BRM1049')  



    ------------------------------
    Avinash Chandra Mandavilli
    ------------------------------



  • 7.  RE: BRMS MSGID Monitoring : CLP

    Posted Mon October 16, 2023 04:51 AM

    Hello Avinash,

    In my last reply a vital element was missing, which is only needed if you wish to mail BRMS messages when running in restricted state.

    Unfortunately there is no BRMS SQL service to get this configured, but it is well documented in another KB item:

    Configuring BRMS backups to use TCP/IP in a restricted state

    Greetings



    ------------------------------
    Rudi Van Helvoirt
    ------------------------------



  • 8.  RE: BRMS MSGID Monitoring : CLP

    Posted Mon October 16, 2023 07:55 AM

    It's not too hard to put what you want as part of the control group.  Like this example:

                                                                  
           Backup                                                        
     Seq   Items       Exit command                                      
       90  *EXIT       SNDMSG MSG('Backup is complete on GDISYS.') TOUSR(...

    So, if you can send a simple message, it wouldn't be too hard to add a simple stored procedure program to retrieve the joblog messages using https://www.ibm.com/docs/en/i/7.5?topic=services-joblog-info-table-function and see how the control group ended.

    See also:  DSPLOGBRM TYPE(*BKU) PERIOD((*AVAIL *CURRENT)) OUTPUT(*OUTFILE)



    ------------------------------
    Robert Berendt IBMChampion
    ------------------------------



  • 9.  RE: BRMS MSGID Monitoring : CLP

    Posted Mon October 16, 2023 02:51 PM

    Hello Robert,

    My control group last *Exit statement is already doing the SNDMSG to QSYSOPR, but what if the control group ended abnormally for some reason. I'm not only looking at BRM1049, but I'm also looking at other BRMS error msg ID's to be alerted. 



    ------------------------------
    Avinash Chandra Mandavilli
    ------------------------------



  • 10.  RE: BRMS MSGID Monitoring : CLP

    Posted Mon October 16, 2023 08:02 AM

    Back to your CL example...

    You have two PGM commands.  Very odd.  I'm wondering if you got your example on how to use MONMSG from a program using it as a 'global' error condition and thus was immediately after a PGM command.  But if you want a local MONMSG you just put it after the command you want to monitor.

    Also certain commands only allow certain messages to be monitored.  If you prompt STRBKUBRM and hit F1 for help, then hit F2 for Extended Help and roll many screens to the bottom you will see a list of *ESCAPE messages which can be monitored by MONMSG.  The message you want is NOT one of them.  That message is a completion or diagnostic message and not an escape message.

    None of this message is to be misconstrued as overly critical.  You acknowledged your limited CL skills and I'm just trying to help you.



    ------------------------------
    Robert Berendt IBMChampion
    ------------------------------



  • 11.  RE: BRMS MSGID Monitoring : CLP

    Posted Mon October 16, 2023 02:59 PM

    Hello Robert,

    Yes, that was mistakenly done. I'm not only looking at BRM1049, but I'm also looking at other BRMS error msg ID's to be alerted. 

    For ex: I should be alerted that BRMS control group BKU completed normally, BRMS control group ended abnormally & BRMS control group completed with errors. 

    Sure. I will check as you stated << If you prompt STRBKUBRM and hit F1 for help, then hit F2 for Extended Help and roll many screens to the bottom you will see a list of *ESCAPE messages which can be monitored by MONMSG >>



    ------------------------------
    Avinash Chandra Mandavilli
    ------------------------------



  • 12.  RE: BRMS MSGID Monitoring : CLP

    Posted Mon October 16, 2023 03:19 PM

    Just noticed something else.  STRBKUBRM ... SBMJOB(*YES)

    The only *ESCAPE message you're ever going to get is if it cannot submit the job to run as another job.  Which is unlikely unless your default job description uses a nonexistent job queue or some such thing.  Try something like this.

    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



    ------------------------------
    Robert Berendt IBMChampion
    ------------------------------



  • 13.  RE: BRMS MSGID Monitoring : CLP

    Posted Wed October 25, 2023 06:24 AM

    Hello Robert & all,

    I implemented in the following way , now i being alerted when backup completes, ended abnormally or completed with errors . Sample CLP below

    Thank you for all your responses and Inputs 

          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) +
                              MSGID(&MSGID)

          IF COND(&MSGID *EQ 'BRM1049') THEN(DO)
                 SNDDST     TYPE(*LMSG) +
                              TOINTNET((abcd@gmail.com *PRI)) +
                              DSTD(DAILYT) LONGMSG(&BRM1049) +
                              SUBJECT(&BRM1049)
              DLYJOB DLY(15)
              GOTO  CMDLBL(DONE)
          ENDDO
             GOTO CMDLBL(LOOP)



    ------------------------------
    Avinash Chandra Mandavilli
    ------------------------------



  • 14.  RE: BRMS MSGID Monitoring : CLP

    Posted Thu October 26, 2023 09:54 AM

    Nice solution. We have the SNDSMTPEMM command embedded in our control group backups. It tells us when a backup starts & completes. A handy, quick way to notify yourself about how a backup ran (or didn't). We have a BRMS control group that has several STRBKUBRM commands in it. We have a before and after SNDSMTPEMM command for each of them. A rather simple way to help yourself. Of course, make sure the SMTP server is running.



    ------------------------------
    Michael Mayer
    IBM i on Power System Admin
    ERMCO-ECI
    Dyersburg, Tennessee 38024
    731.676.4318
    Blog: https://ibmireference.blogspot.com
    ------------------------------



  • 15.  RE: BRMS MSGID Monitoring : CLP

    Posted Fri October 27, 2023 11:08 AM

    Hello Michael,

    When you say embedded in your control group - are you referring it as EXIT statement for SNDSMPTEMM ?

    If yes - we can do that way when backup starts and backup completes , but how could you embed it with for control group backup ended abnormally/ completed with errors ? 

    That is the reason , We wrote a sample program for those error messages to be monitored.



    ------------------------------
    Avinash Chandra Mandavilli
    ------------------------------



  • 16.  RE: BRMS MSGID Monitoring : CLP

    Posted Fri October 27, 2023 11:19 AM

    When you say embedded in your control group - are you referring it as EXIT statement for SNDSMPTEMM ? --- Yes.

    If yes - we can do that way when backup starts and backup completes , but how could you embed it with for control group backup ended abnormally/ completed with errors ? --- Like I said, it's a simple

    down and easy way to get notified when the backed starts and ends.

    That is the reason , We wrote a sample program for those error messages to be monitored. --- I agree, to monitor the backup from beginning to end, your program is a nice solution. We also use ROBOT software

    watch our processes. Something goes sideways, we get the system message. Then of course we use DSPLOGBRM to dig into it.

     

     

    Respectfully,

    Michael Mayer
    IBM i on Power System Admin
    ERMCO-ECI
    2225 Industrial Rd
    Dyersburg, Tennessee 38024
    Office and OnCall: 731.676.4318
    Cell: 518.641.8906
    Email: 
    michael.mayer@ermco-eci.com
    https://www.ermco-eci.com  
    IBM i Personal Blog: https://ibmireference.blogspot.com          

    "Success is not final. Failure is not fatal. It is the courage to continue that counts".

     

     

         

     

     

     

     

     






  • 17.  RE: BRMS MSGID Monitoring : CLP

    Posted Fri October 27, 2023 10:07 AM

    Where is cmdlbl(done)? Seems to be missing.



    ------------------------------
    Michael Mayer
    IBM i on Power System Admin
    ERMCO-ECI
    Dyersburg, Tennessee 38024
    731.676.4318
    Blog: https://ibmireference.blogspot.com
    ------------------------------