Operating System - Linux
1827882 Members
1152 Online
109969 Solutions
New Discussion

Re: Problem in log generation in USS

 
SOLVED
Go to solution
Sandeep Dwivedi
New Member

Problem in log generation in USS

When i am trying to run the same script on USS which i ran successfully on UNIX
I am getting an error.

This is the part of the script which is giving an error. I want the output to be on the screen and also a log should be generated.

tee ../logs/build_bo_jar.log >/dev/tty |&
exec 2>&p 1>&2

Error is
exie 19: FSUM7341 bad file descriptor "p"
zOS 1.6 [/indus2/icapi/fw600/scripts]

Thanks in Adwance
10 REPLIES 10
Sandman!
Honored Contributor

Re: Problem in log generation in USS

what is USS?
Sandeep Dwivedi
New Member

Re: Problem in log generation in USS

USS is unix system services.
UNIX System Services allows UNIX applications from other platforms to run on IBM mainframes.
USS is a certified UNIX implementation (XPG4 UNIX 95) optimized for mainframe architecture.
Through integration with the rest of z/OS, additional time share option (TSO) commands are available alongside the usual UNIX services, making it possible to process UNIX files using ISPF. Extensions in JCL make it possible to use these files in batch processing.
Dennis Handly
Acclaimed Contributor

Re: Problem in log generation in USS

>USS is a certified UNIX implementation (XPG4 UNIX 95)

I can't see &p (co-process) as being valid in UNIX95 through UNIX2003. So it seems that USS doesn't have to support it.

I would also think that would make |& useless.
(Right, I don't see it in UNIX2003.)
Sandeep Dwivedi
New Member

Re: Problem in log generation in USS

Thanks
is there any other way of generating a log in USS?
Rasheed Tamton
Honored Contributor

Re: Problem in log generation in USS

This will generate the output on the screen as well as to a file (plus the error message, if any).

cat ../logs/build_bo_jar.log 2>&1 |tee jarlog.log



Regards.
Dennis Handly
Acclaimed Contributor
Solution

Re: Problem in log generation in USS

>Rasheed: cat ../logs/build_bo_jar.log 2>&1 |tee jarlog.log

Unfortunately I believe build_bo_jar.log IS the log file. Of course that leads to a solution, output to the log file, then do a tail -f on that log file. Or a cat(1) when done.
Sandeep Dwivedi
New Member

Re: Problem in log generation in USS

Rashid / Dennis

Thanks for your advices. I tried them but
This solution is not working.
It is just creating build_bo_jar.log and jarlog.log of 0 size.
Dennis Handly
Acclaimed Contributor

Re: Problem in log generation in USS

I'm lost, you'll need to show us what you are currently doing. Perhaps a script fragment with some echos showing the output you want to track.
Sandeep Dwivedi
New Member

Re: Problem in log generation in USS

This is the script wch i am running in USS,
Since its an interactive script (accepts input from user) so the log generation become more complex.
I want to print output on the console as well as the same output should go inside a log file.
Please suggest me a method
_____________________

#!/bin/ksh
##############################################################################
# Modification History
# 04/16/07 - Sandeep Dwivedi - Original Version
#
##############################################################################

export JAVAPATH=/usr/lpp/zWebSphere/V6R1/java/J5.0/bin
export ICDIR=/myregion/icapi/fw600
export CLASSPATH=$ICDIR/bometa_class:$ICDIR/webapps/apifw/WEB-INF/lib/apifw.jar:$ICDIR/bometa_class/com/mycompany/apibo/metadata/$1

clear
BONAME=$1

#-----------------------------------------------------------------#
# Sub routines
#-----------------------------------------------------------------#

exit_process()
{
echo "--------------------------------------------------------------------"
exit
}

#-----------------------------------------------------------------#
# Pre checks
#-----------------------------------------------------------------#

# Check if no BOName was provided and also prompt for a BOName
if [ $# -lt 1 ] ; then
echo "\nYou MUST include a BOName"
echo "\nTo view valid BOName's, Press Enter"
line
ls -C $ICDIR/bometa_javasrc/com/mycompany/apibo/metadata/
echo "\nYou must not include more than One BOName. Please provide a BOName : "
read BONAME
BONCNT1=`echo $BONAME|wc -w`
if [ $BONCNT1 -gt 1 ] ; then
echo "\nYou MUST not include more than one BOName\n"
exit_process
fi
if [ -z $BONAME ] ; then
echo "\nYou MUST include a BOName\n"
exit_process
fi
echo "\nBONAME is $BONAME"
fi

# Check if more than one BOName's are entered
if [ $# -gt 1 ] ; then
echo "\nYou MUST not include more than one BOName\n"
exit_process
fi

# Check whether the BOName is valid or not
echo "\nSearching for validity of BONAME in $ICDIR/bometa_javasrc/com/mycompany/apibo/metadata"
test -d $ICDIR/bometa_javasrc/com/mycompany/apibo/metadata/$BONAME
find_status=$?
if [ $find_status -gt 0 ] ; then
echo "\nBOName not found, Please specify a VALID BOName\n"
exit_process
fi

#-----------------------------------------------------------------#
# Main Program
#-----------------------------------------------------------------#

echo "Creating temporary directory temp$$"
mkdir $ICDIR/bometa_lib/temp$$
echo

echo "Compiling $BONAME source into class files"
$JAVAPATH/javac -verbose -classpath $CLASSPATH -d $ICDIR/bometa_lib/temp$$ $ICDIR/bometa_javasrc/com/mycompany/apibo/metadata/$BONAME/*.java
echo

echo "Copying $BONAME class files to the classes directory"
cp -r $ICDIR/bometa_lib/temp$$/* $ICDIR/bometa_class
echo

cd $ICDIR/bometa_lib/temp$$
echo "Creating jar file $ICDIR/bometa_lib/ICBO-$BONAME.jar"
$JAVAPATH/jar -cvf $ICDIR/bometa_lib/ICBO-$BONAME.jar ./*
echo

echo "Copying ICBO-$BONAME.jar to $ICDIR/webapps/apifw/WEB-INF/lib/ICBO-$BONAME.jar"
cp $ICDIR/bometa_lib/ICBO-$BONAME.jar $ICDIR/webapps/apifw/WEB-INF/lib/ICBO-$BONAME.jar
echo

cd $ICDIR
echo "Removing temporary directory temp$$"
rm -r $ICDIR/bometa_lib/temp$$
echo

exit_process
Dennis Handly
Acclaimed Contributor

Re: Problem in log generation in USS

Ok, thinking about it, you can of course send all of your output to a new file. Then at the end, copy that output to your logfile, then to the tty. Fortunately you have a nice function exit_process where you can do this clean up.

(Add somewhere at the top)
TMP=/var/tmp/foo.log # add $$ if you have multiple occurrences
exec 3>&1 # save old stdout
exec 4>&2 # save old stderr, needed?
exec > $TMP 2>&1 # redirect both to $TMP

And in exit_process: (I'm sending to stdout vs /dev/tty, you can change that.)

# Copy from $TMP to log and to stdout:
cat $TMP >> ../logs/build_bo_jar.log
cat $TMP 1>&3
rm -f $TMP