如何於 CLP 中傳送著色的訊息?(Send colored message in CLP)
File : QCLSRC
Member: SNDCOLMSGC
Type : CLP
Usage : CRTCLPGM SNDCOLMSGC
OS Version: All
/* TO COMPILE : */
/* */
/* CRTCLPGM PGM(XXX/SNDCOLMSG) SRCFILE(XXX/QCLSRC) */
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(&MSGTYPE)
END: ENDPGM
此程式中有二個 SNDPGMMSG 指令,你可以選取一種顯示方式或二者。
二者顯示方式稍有不同,可以自行比較一下。
File : QCMDSRC
Member: SNDCOLMSG
Type : CMD
Usage : CRTCMD CMD(SNDCOLMSG) PGM(SNDCOLMSGC)
OS Version: All
/* Description : Send a colored message */
/* */
/* To compile : */
/* */
/* CRTCMD CMD(XXX/SNDCOLMSG) PGM(XXX/SNDCOLMSG) + */
/* SRCFILE(XXX/QCMDSRC) */
/* */
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')
執行範例:
SNDCOLMSG MSG('Hello World') COLOR(*PINK)
SNDCOLMSG MSG('Error') COLOR(*RED_REVERSE_BLINK)
A blog about IBM i (AS/400), MQ and other things developers or Admins need to know.
星期一, 11月 06, 2023
2003-02-19 如何於 CLP 中傳送著色的訊息?(Send colored message in CLP)
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言