Sunday, February 24, 2008

Add color to the messages:

Usually when we send the Program messages from a CL program, the message will be shown in normal white color. We can also add color to the program messages that adds more meaning to the message sent.
If you compile the following short program and call it from a command line, you'll see what I mean.

DCL VAR(&BLUE) TYPE(*CHAR) LEN(1) VALUE(X'3A')
DCL VAR(&WHITE) TYPE(*CHAR) LEN(1) VALUE(X'22')
DCL VAR(&GREEN) TYPE(*CHAR) LEN(1) VALUE(X'20')

SNDPGMMSG MSGID(CPF9897) MSGF(QCPFMSG) MSGDTA(&BLUE +
*CAT 'This is' *CAT &WHITE *CAT 'the' +
*CAT &GREEN *CAT 'msg') MSGTYPE(*ESCAPE)

You may use more than one display attribute in a message. In the following code fragment, written for a color monitor, parts of the message are shown in blue, white, and green.
Similarly we can give the hexa values of the display attributes and add color and more meaning to our message.

No comments: