﻿--  category:  IBM i Services for BRMS
--  description:  Application - BRMS Distribution Messages
--  minvrm: V7R3M0
--  last updated: 3/14/2023

--
-- Setup the BRMS Distribution server
-- QUSRBRM.SET_BRMS_DISTRIBUTION_SERVER(
-- PRIMARY_SERVER=> primary-server,
-- SECONDARY_SERVER => secondary-server,
-- EMAIL_ADDRESS => email-address)
-- Example set up with no secondary server
--
CALL QUSRBRM.SET_BRMS_DISTRIBUTION_SERVER(
    'APPN.PRIMARY',
    'NONE',
    'myemail@company.com'
);

--
-- View the BRMS Distribution Message setup
--
SELECT DISTINCT PRIMARY_SERVER,
                SECONDARY_SERVER,
                EMAIL_ADDRESS
    FROM QUSRBRM.BRMS_DISTRIBUTION_MESSAGES;

--
-- View the messages that are set up to be distributed
--
SELECT MESSAGE_ID
    FROM QUSRBRM.BRMS_DISTRIBUTION_MESSAGES;


--
-- Example: Add a single message BRM1049 for email notification
--
CALL QUSRBRM.ADD_BRMS_DISTRIBUTION_MESSAGE('BRM1049');

--
-- Example: Add 5 additional messages, CPF0001, MCH0001, BRM0001, CPF9898 and MCH3601 for email notification
--
CALL QUSRBRM.ADD_BRMS_DISTRIBUTION_MESSAGE('CFP0001 MCH0001 BRM0001 CPF9898 MCH3601');

--
-- Example: Remove a single message BRM1049 for email notification
--
CALL QUSRBRM.REMOVE_BRMS_DISTRIBUTION_MESSAGE('BRM1049');

--
-- Example: Remove 5 additional messages, CPF0001, MCH0001, BRM0001, CPF9898 and MCH3601 for email notification
--
CALL QUSRBRM.REMOVE_BRMS_DISTRIBUTION_MESSAGE('CFP0001 MCH0001 BRM0001 CPF9898 MCH3601');

