The solution, in a nutshell, is to create a Validity Checking program for the SNDBRKMSG command. This program will verify if the message-queue parameter specified has been specified as *ALLWS (while sending a message). If so, it will not allow the message to be sent. Thus, a user can send a break message only to a single workstation at a time. For convenience, a copy of the original command can be maintained in a separate library. This copy, which is allowed *ALLWS parameter, can be used only by the system operator/administrator to broadcast critical messages.
Program: BRKVLDC
/***************************************************************************
**/
/* SNDBRKMSG HAS 5 PARAMETERS. HENCE 5 DECLARATIONS ARE REQUIRED */
/* Length of all parameters - except T2 (Workstation MSGQ) - is immaterial
*/
/***************************************************************************
**/
PGM PARM(&T1 &T2 &T3 &T4 &T5)
DCL VAR(&T1) TYPE(*CHAR) LEN(1)
DCL VAR(&T2) TYPE(*CHAR) LEN(20) /* MSGQ + Lib-name */
DCL VAR(&T3) TYPE(*CHAR) LEN(1)
DCL VAR(&T4) TYPE(*CHAR) LEN(1)
DCL VAR(&T5) TYPE(*CHAR) LEN(1)
DCL VAR(&T2SUB) TYPE(*CHAR) LEN(10)
/* Actual WS-MSGQ name starts from the 3rd char. */
/* 1st 2 character contains the number of entries on this parameter */
CHGVAR VAR(&T2SUB) VALUE(%SST(&T2 3 10))
/************************************************************/
/* If entry = *ALLWS, 'Escape' disallow message-sending */
IF COND(&T2SUB *EQ '*ALLWS') THEN(DO)
SNDPGMMSG MSGID(CPF0002) MSGF(QSYS/QCPFMSG) +
MSGTYPE(*ESCAPE)
GOTO END
ENDDO
/*********************************************************/
END: ENDPGM
Compile above program. Attach it to SNDBRKMSG command:
CHGCMD CMD(SNDBRKMSG) VLDCKR(MYLIB/BRKVLDC)
================================== MORE INFORMATION ON THIS TOPIC ==================================
The Best Web Links: Tips, tutorials and more.
Ask your systems management questions--or help out your peers by answering them--in our live discussion forums.
Read this Search400.com Featured Topic: Managing your iSeries.
Ask the Experts yourself: Our systems management gurus are waiting to answer your technical questions.
This was first published in January 2004