Tandem Public Download Files

Message Logger - nonstop code example

This is my skeleton (yes we all use skeletons) for nonstop program code. What it does is just write any message it recieves in $recieve to a logfile (excluding those with a hometerm of $zbat) recording the hometerm and userid of the requestor and the text along with a datestamp of course. Effectively it does the same function as the tacl logger program in one of the tandem manuals but I have added a few extra bits to make it a nonstop process pair.
It is a very basic skeleton, it does not cover the stuff like multiprocessing (ie: accepting messages using tags and being able to respond to messages out of sequence as needed; say two (or more) requests come in and the first waits on (nowaited) io longer than the second the second is replied to first back to the correct requestor). And yes I do have a nonstop skeleton like that, but thats used in commercial code so I can't post it here.

What you will learn:This programming example gives you the following

The program source, macro library, plus start, stop and restart obey files have been packaged into a tar.gz fileTAL and TACL source files.
You can probably do without the start ('msgcmd checkenv' will start it), the stop ('msgcmd shutdown' will stop it) and the resart ('msgcmd recycle' will stop/start it) files, but I have included them as the start/stop can be used from system startup/shutdown obey files without needing to load the macro library.

Syntax

All commands are entered via the macro library routines, you must have loaded the macro library before trying to enter any of these commands. If the macro library is loaded prefix each command below with msgmac and away you go.
Important: you will have course customised the macro library to include the CPUs you have available, the log directory you want to use etc. before starting the program :-).

MSGCMD Commands available...
 BACKUPCPU  nn|STOP (change backup process cpu or stop backup process)
 CHECKENV [QUIET]   (check that all processes are running, start if needed)
 DEBUGMODE ON|OFF   (if on rund the server, default is off)
 EMSCOLL <process>  (change the event collector status messages are logged to)
 EMSDIST [setupparm](start an emsdist against the event collector)
 HELP command       (help on each individual command)
 INIT               (reset program counters)
 LOG                (log a message to the current days log)
 PRIMARYCPU nn      (change primary process cpu)
 RECYCLE            (stop and restart the msgloger process)
 SHUTDOWN           (stop program)
 STATUS             (log internal info)
 VERSION            (show the version of the macro library)
 VERBOSE ON|OFF     (turn verbose message display on or off)
 VIEWLOG [daysback] (view the current days log file, or log for n daysback)

There is detailed help for each command available through MSGCMD HELP command
ie: MSGCMD HELP VIEWLOG

Important Notes

The viewlog option requires esds installed, you will probably need to change the routine that uses that to replace it with your sites file viewer. esds was a tool I wrote a long time ago as a full screen file viewer for entry sequenced files for DP1, and when DP2 came it it was converted to run on DP2 disks. I know that in NZ at least it has appeared in companies I never worked for before (hmmmm..) but if you don't have that or another full screen file viewer you might want to remove the viewlog option. The esds source disappeared a long time ago, who would have expected a program to still be in use 20yrs after it had been written ?; and esds was written when I was gainfully employed so I couldn't redistribute that anyway.

For reference, the supplied start file

Shown here for reference as a way of explaining the parameters that the msglog program expects and uses.

?TACL MACRO
#FRAME
[#IF NOT [#PROCESSEXISTS $TLOG] |THEN|
   == Define for event collector for log messages
   == if =logger_ems_collector is set to file $NONE rather than
   == a valid process name then no event logging to an event
   == collector will be done by the program.
   ADD DEFINE =LOGGER_EMS_COLLECTOR,CLASS MAP, FILE $0
   == Param indicates how many days to keep log files
   PARAM LOGGER-DATA-KEEP 30
   == Param indicates security to be set when logfiles created
   PARAM LOGGER-DATA-SECURITY NOOO
   == Assign to define the log file structure and space allocations
   ASSIGN LOGGER-DATA-FILE,$SYSTEM.TACLLOG.T,CODE 0,EXT (50,50), &
        REC 132, BLOCK 4096
   == Start the logger task
   == The CPUs should match what you have set in the macro library
   RUN $SYSTEM.TACLLOG.MSGLGOBJ /NAME $TLOG, CPU 1,NOWAIT,PRI 130/ 0
   == Clean up
   DELETE DEFINE =LOGGER_EMS_COLLECTOR
   CLEAR ALL ASSIGN
   CLEAR ALL PARAM
|ELSE|
   #OUTPUT TACL LOGGER TASK $TLOG IS ALREADY RUNNING.
]
#UNFRAME

The MSGLOGER program is free for anyone to download and customise for their own use, as long as it is never included in a commercial package (simply because I don't want someone saying five years from now I can no longer distribute this because they have made it part of a commercial tooolkit).