NET/MASTER Network Control Language (NCL) Programmer's Guide
Examples of System-Level NCL Procedures
Developing System-Level NCL Procedures
106160 Tandem Computers Incorporated 17–37
It does not delete messages and it does not change messages. It produces the same
result as having no MSGPROC.
Note As discussed earlier in this section, the MSGCONT verb is not required after the MSGREAD verb when a
message is passed on with no changes.
The following MSGPROC NCL procedure allows all messages arriving at an OCS
window to pass through for display; it displays consecutive messages in different
colors—blue, red, white, pink, and yellow:
zex1716n: PROCEDURE
/* Displays messages in color */
SAY MSGPROC starting
&counter = 1
DO FOREVER
MSGREAD
SELECT &counter
WHEN 1 THEN MSGCONT COLOR=BLUE
WHEN 2 THEN MSGCONT COLOR=RED
WHEN 3 THEN MSGCONT COLOR=WHITE
WHEN 4 THEN MSGCONT COLOR=PINK
OTHERWISE
MSGCONT COLOR=YELLOW
END
&counter = &counter + 1
IF &counter > 5 THEN
&counter = 1
END
END zex1716n
The following MSGPROC NCL procedure traps all messages sent to an OCS window
and selectively logs messages to a file:
zex1717n: PROCEDURE
/* MSGPROC to trap all messages sent to an OCS window */
/* and selectively log messages to a file. */
/* You turn on logging by typing AAAAA at the OCS */
/* command input line. You turn off logging by typing */
/* ZZZZZ at the OCS command input line. */
ON ERROR FLUSH /* Error handler */
SAY MSGPROC starting
CALL create_file /* Create log file */
&log = ""
DO FOREVER /* Trap messages */
MSGREAD VARS=&word* /* Put text to words*/
&log = &word&(SYS.VARCNT) /* Get last word */
IF &log = AAAAA THEN DO /* Begin logging if */
SAY "Logging enabled" /* AAAAA is last on */
CALL log SHARE &$msg. /* line and open log*/
END /*do*/
END /*do forever*/ /* Get next message */
/* ==================== CREATE FILE ===================== */