A few scripts that can be called from OPS/REXX using the USS servers.
Methods for OPSMVS to process messages from z/OS USS application files
One way is by using the tail command and piping the output to a program called logger. Logger is described in the USS commands manual and it will send messages from USS to the syslog. OPSMVS will see these as message events and can be processed with )MSG rules. Here is a sample script that would reside in an HFS. This script assumes that a log file name is passed as an argument. ($1 and $2 represent arguments passed). It also assumes that a 'tag' is passed which is placed in front of the message. This tag helps in that you would know what )MSG to automate. Otherwise, the beginning of the Logger output varies with timestamps and dates.
# tail a file and issue logger to send messages to console
# logrscript file TAG456
if test x$1 = x; then
echo "Provide a filename. EX: logrscript /u/lpp/file.log"
if test x$2 = x; then
$2 = AVB333
nohup tail -f +0 $1 | logger -a $2 &
This script can be called from OPS/REXX using the USS servers. The sample OPS/REXX below assumes the above UNIX script resides in directory /u/users/opsmvs/youruserid and the script is called logrscript2. It is passing a file called russ.log in the same directory and using AVB444 as the tag. Thus all messages from russ.log will be prefixed with AVB444.
/******** REXX **************************************/
/** logrscript arg1 is a file arg2 is message tag */
/* logrscript does a tail -f of a file and pipes to logger so */
/* lines in file go to console */
ADDRESS USS "USSCMD " ,
"COMMAND('nohup "||dir||"/logrscript2 "||dir||"/russ.log AVB444 &')"
/* " wait(10) stem(answer)" */
say 'usscode ' usscode
say 'ussreason ' ussreason
If answer.0 > 0
then do i=1 to answer.0
Another method would be to use z/OS CCS EM (Event Manager).
# This script will feed a log file into the Framework event manager
# This assumes that the environmental variables for event manager
# have been set via a profile. (The OPSUSS ENVFILE should already do
# this for you.)
# The CA_UNAME and PIPE_FILE variables are resolved to help build the
# name of the event manager pipe that resides on this system.
# The output of the tail command will be sent to the event manager pipe.
# tail -f +1 $1 > $CAIGLBL0000/opr/config/$CA_UNAME/pipe/$PIPE_FILE &
# -f option will follow the file as it grows and not stop at EOF.
# +1 will start at the line 1 of the file
# $1 is the file name passed to this script.
# > redirects the output of the tail command
# $CAIGLBL0000/opr/config/$CA_UNAME/pipe/$PIPE_FILE The $variables
# will be resolved and you will have the pipe name for the event
# event manager.
# & runs the process in the background.
if test x$1 = x; then
echo "Provide a filename. EX: appllog /user/appl/file.log"
nohup tail +1 $1 > $CAIGLBL0000/opr/config/$CA_UNAME/pipe/$PIPE_FILE &
** You could call this script from OPS/REXX in the similar manner shown above. The messages using the EM method will show as USS events in OPSLOG and can be processed with )USS rules. **