Send Message (CLLE)
/*-------------------------------------------------------------------*/
/* 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
Thanks to Terry Winchester
And in RPG:
**
** Program . . : CBX505
** Description : QEZSNDMG send message API - Test
** Author . . : Carsten Flensburg
**
**
** Compile options:
** CrtRpgMod Module( CBX505 )
** DbgView( *LIST )
**
** CrtPgm Pgm( CBX505 )
** Module( CBX505 )
** ActGrp( QILE )
**
**
**-- Header specifications: --------------------------------------------**
H Option( *SrcStmt )
**-- System information:
D PgmSts Sds Qualified
D CurJob 10a Overlay( PgmSts: 244 )
D UsrPrf 10a Overlay( PgmSts: 254 )
D JobNbr 6a Overlay( PgmSts: 264 )
D CurUsr 10a Overlay( PgmSts: 358 )
**-- Global variables & constants:
D MsgTxt s 256a Varying
D Inz( 'This is a test message' )
D FncRqs s 10i 0
D MsgSntInd s 10i 0
**-- Api error data structure:
D ERRC0100 Ds Qualified
D BytPro 10i 0 Inz( %Size( ERRC0100 ))
D BytAvl 10i 0 Inz
D MsgId 7a
D 1a
D MsgDta 128a
**-- Send message:
D SndMsg Pr ExtPgm( 'QEZSNDMG' )
D MsgTyp 10a Const
D DlvMod 10a Const
D MsgTxt 494a Const Options( *VarSize )
D MsgTxtLen 10i 0 Const
D MsgRcv 10a Const Options( *VarSize ) Dim( 299 )
D MsgRcvNbr 10i 0 Const
D MsgSntInd 10i 0
D FncRqs 10i 0
D Error 32767a Options( *VarSize )
D ShwSndMsgDsp 1a Const Options( *NoPass )
D MsgQueNam 20a Const Options( *NoPass )
D NamTypInd 4a Const Options( *NoPass )
D CcsId 10i 0 Const Options( *NoPass )
/Free
SndMsg( '*INFO'
: '*BREAK'
: MsgTxt
: %Len( MsgTxt )
: PgmSts.UsrPrf
: 1
: MsgSntInd
: FncRqs
: ERRC0100
: 'N'
: *Blanks
: '*USR'
);
*InLr = *On;
Return;
/End-Free
Thanks to (as usual) Carsten Flensburg
阅读(865) | 评论(0) | 转发(0) |