Return to the API Tips
Another example of using QEZSNDMG to SNDBRKMSG to an user or only active work stations.
From: Terry Winchester
/*-------------------------------------------------------------------*/ /* Program: BRKMSG */ /* Description: Receive two parameters from any program and send */ /* a message to any User using the QEZSNDMG API from */ /* the Operational Assistant menu. */ /* */ /* &MSGTEXT - 80 character message */ /* &USERID - 10 character UserId to receive msg */ /* */ /* Notes: -The message text passed to this program */ /* should be limited to 80 chars. */ /* -If the user has multiple sessions open, */ /* each session will receive a message. */ /* -Use *ALLACT as USERID to notify everyone */ /*-------------------------------------------------------------------*/ PGM PARM(&MSGTEXT &USERID) DCL VAR(&MSGTYPE) TYPE(*CHAR) LEN(10) + VALUE('*INFO') DCL VAR(&DELMODE) TYPE(*CHAR) LEN(10) + VALUE('*BREAK') DCL VAR(&MSGTEXT) TYPE(*CHAR) LEN(80) DCL VAR(&MSGLENG) TYPE(*CHAR) LEN(04) + VALUE(X'00000050') DCL VAR(&USERID) TYPE(*CHAR) LEN(10) DCL VAR(&USRCNT) TYPE(*CHAR) LEN(04) + VALUE(X'00000001') DCL VAR(&MSGSENT) TYPE(*CHAR) LEN(04) + VALUE(X'00000000') DCL VAR(&FUNCREQ) TYPE(*CHAR) LEN(04) + VALUE(X'00000000') DCL VAR(&ERROR) TYPE(*CHAR) LEN(256) + VALUE(X'00000100') DCL VAR(&SHOWMSG) TYPE(*CHAR) LEN(01) VALUE('N') DCL VAR(&REPLYMQ) TYPE(*CHAR) LEN(20) DCL VAR(&NAMETYPE) TYPE(*CHAR) LEN(04) + VALUE('*USR') CALL PGM(QEZSNDMG) PARM(&MSGTYPE &DELMODE + &MSGTEXT &MSGLENG &USERID &USRCNT + &MSGSENT &FUNCREQ &ERROR &SHOWMSG + &REPLYMQ &NAMETYPE) ENDJOB: ENDPGM
[report a broken link by clicking here]