用户经常发送MESSAGE,MESSAGE的颜色往往是绿色的,其实是可以发送彩色的MESSAGE的。
解答 1.创建SNDCOLMSG CLP程序。
SNDCOLMSG: PGM PARM(&MSG &COLOR &MSGTYPE)
DCL VAR(&MSG) TYPE(*CHAR) LEN(80)
DCL VAR(&COLOR) TYPE(*CHAR) LEN(1)
DCL VAR(&MSGTYPE) TYPE(*CHAR) LEN(10)
DCL VAR(&LASTBYTE) TYPE(*CHAR) LEN(1) VALUE(X'20')
DCL VAR(&TEXT) TYPE(*CHAR) LEN(82)
CHGVAR VAR(&TEXT) VALUE(&COLOR *CAT &MSG *TCAT
&LASTBYTE)
SNDPGMMSG MSG(&TEXT) TOPGMQ(*EXT) MSGTYPE(&MSGTYPE)
SNDPGMMSG MSG(&TEXT) MSGTYPE(&MSG)
END: ENDPGM
2.创建命令SNCCOLMSG
CRTCMD CMD(SNDCOLMSG) PGM(SNDCOLMSGC)
SNDCOLMSG: CMD PROMPT('Send colored message')
PARM KWD(MSG) TYPE(*CHAR) LEN(80) PROMPT('Message')
PARM KWD(COLOR) TYPE(*CHAR) LEN(1) RSTD(*YES)
DFT(*GREEN) SPCVAL(
(*GREEN X'20')
(*GREEN_REVERSE X'21')
(*WHITE X'22')
(*WHITE_REVERSE X'23')
(*GREEN_UNDERSCORE X'24')
(*GREEN_UNDERSCORE_REVERSE X'25')
(*WHITE_UNDERSCORE X'26')
(*RED X'28')
(*RED_REVERSE X'29')
(*RED_BLINK X'2A')
(*RED_REVERSE_BLINK X'2B')
(*RED_UNDERSCORE X'2C')
(*RED_UNDERSCORE_REVERSE X'2D')
(*RED_UNDERSCORE_BLINK X'2E')
(*TURQUOISE X'30')
(*TURQUOISE_REVERSE X'31')
(*YELLOW X'32')
(*YELLOW_REVERSE X'33')
(*TURQUOISE_UNDERSCORE X'34')
(*TURQUOISE_UNDERSCORE_REVERSE X'35')
(*YELLOW_UNDERSCORE X'36')
(*PINK X'38')
(*PINK_REVERSE X'39')
(*BLUE X'3A')
(*BLUE_REVERSE X'3B')
(*PINK_UNDERSCORE X'3C')
(*PINK_UNDERSCORE_REVERSE X'3D')
(*BLUE_UNDERSCORE X'3E')
) PROMPT('Color')
PARM KWD(MSGTYPE) TYPE(*CHAR) LEN(10) RSTD(*YES) +
DFT(*INFO) VALUES(*INFO *COMP) +
PROMPT('Message type')
3.执行
sndcolmsg msg('sgdsad') color(*blue)
SNDCOLMSG MSG('sgdsad') COLOR(*YELLOW_REVERSE)
sndcolmsg msg('sgdsad') color(*blue)
sndcolmsg msg('sgdsad') color(*pink)
xqlib/sndcolmsg msg('sgdsad') color(*pink)