NET/MASTER Network Control Language (NCL) Programmer's Guide
Examples of System-Level NCL Procedures
Developing System-Level NCL Procedures
17–38 106160 Tandem Computers Incorporated
create_file: PROCEDURE
/* Use FUP to try and create new entry-sequenced file. */
/* Set a large record length because MDO variables with*/
/* messages contain lots of attribute information. */
INTCMD "OPSYS SEND FUP CREATE $DATA2.JOHNNCLS.MSGLOG,",
"TYPE E, REC 4072"
DO UNTIL &msgno = "NNM0999"
INTREAD VARS=(&msgno(7),*,&text) TYPE=ANY PARSE=NO
/* Check if file was created */
IF POS("ERR 10",&text) > 0 THEN DO
/* File exists, so purge data, and leave DO UNTIL */
/* Typing UDBCTL RESET=$DATA2.JOHNNCLS.MSGLOG */
/* before activating this MSGPROC does the same */
INTCMD "OPSYS SEND FUP PURGEDATA $DATA2.JOHNNCLS.MSGLOG"
END /*do*/
ELSE
NOP
END /*do until*/
INTCMD "OPSYS KILL FUP"
INTREAD
END create_file
/* ==================== LOG RECORDS ====================== */
log: PROCEDURE SHARE &$msg.
/* Open private log. You can specify another filename. */
/* You could modify the procedure so that the 1st */
/* parameter you enter is the file name. If so, don't */
/* forget to share it to this LOG procedure. */
INTCMD 'UDBCTL OPEN=$DATA2.JOHNNCLS.MSGLOG ID=MSGLOG'
INTREAD /* Wait for message */
FILE OPEN ID=MSGLOG FORMAT=MAPPED, /* Must be mapped */
MAP=$MSG /* with $MSG */
DO WHILE &log \= ZZZZZ /* Stop logging if */
MSGREAD VARS=&word* /* ZZZZZ is last on */
FILE ADD MDO=&$msg. /* line. */
&log = &word&(SYS.VARCNT) /* Get last word */
END /*do until*/
SAY "Logging disabled"
FILE CLOSE ID=MSGLOG /* Close log */
INTCMD 'UDBCTL CLOSE=$DATA2.JOHNNCLS.MSGLOG'
END log
END zex1717n
In this example, you turn on selective logging by typing AAAAA at the OCS
command input line. You turn off selective logging by typing ZZZZZ at the OCS
command input line. This allows you to create your own personal log of the
commands you enter in OCS and their results. The name of the log file used in this
example is $DATA2.JOHNNCLS.MSGLOG, but you should change the procedure so
that it logs records to a file that is appropriate to your system.