#!/bin/ksh

CLIENTID=`licsta | grep Client | cut -f6 -d' '`


cd /disk2/http
echo "LAWSON Info for $CLIENTID" >> specs.txt
echo "as of: `date`"                  >> specs.txt

HOSTNA=`uname -n`
OSTYPE=`uname -s`
OSPREF=`uname -s|cut -c1-2`
OSREL=`uname -r`
OSVER=`uname -v`
case $OSPREF in
    AI) UNIXVER=$OSVER.$OSREL ;;

    HP) UNIXVER=$OSREL ;;

    OS) UNIXVER=$OSREL.$OSVER ;;

    Su) UNIXVER=$OSREL ;;

    DY) UNIXVER=$OSREL ;;

    sc) UNIXVER=$OSREL.$OSVER ;;

    UN) UNIXVER=$OSREL.$OSVER ;;

    *) UNIXVER="Unknown System" ;;    
esac

echo "Client/UNIX version information" >> specs.txt
echo "Client ID: html"   >> specs.txt
echo " Hostname: $HOSTNA"     >> specs.txt
echo "  IP Addr: `grep $HOSTNA /etc/hosts|grep '\.'|head -1|cut -f1`">> specs.txt
echo " Platform: $OSTYPE"     >> specs.txt
echo "     UNIX: $UNIXVER"    >> specs.txt
echo " COBOL Compiler information "      >> specs.txt
echo "  Version: `lacobrts 2>&1 |grep '\;'|head -1| cut -f1 -d\;`">> specs.txt

echo "PRN: `cob -V 2>/dev/null | grep PRN|head -1|cut -f2- -d\:`" >> specs.txt

echo " Run Time: `lacobrts 2>&1 |grep '\;'|head -1| cut -f11 -d' '`">> specs.txt


INFBIN=
ORABIN=
ORAHM=
SYBBIN=

INFBIN=`find ${INFORMIXDIR:=/Informix} -name dbaccess -print 2>/dev/null | head -1`
ORABIN=`find ${ORACLE_HOME:=/Oracle} -name sqldba -print 2>/dev/null | head -1`

if test -z "$ORABIN"
then
   ORAHM=$ORACLE_HOME/orainst
fi

SYBBIN=`find ${SYBASE:=/Sybase} -name dataserver -print 2>/dev/null | head -1`

if test -n "$INFBIN" -o -n "$ORABIN" -o -n "ORAHM" -o -n "$SYBBIN"
then

    if test -n "$INFBIN"
    then 
	echo " INFORMIX: `$INFBIN -v|head -1|cut -f3 -d' '" >> specs.txt
    fi

    if test -n "$ORABIN"
    then 
	echo "ORACLE: `$ORABIN -v|grep SQL|head -1|cut -f3 -d' '`">> specs.txt
    fi

    if test -n "$ORAHM"
    then 
	echo "ORACLE: `$ORAHM/inspdver | grep RDBMS | grep Server | cut -c1-10`" >> specs.txt
    fi

    if test -n "$SYBBIN"
    then 
	echo "   SYBASE: `$SYBBIN -v|grep SQL|head -1|cut -f2 -d'/'`">> specs.txt
    fi
fi

COBPATHVAR=`env|grep 'coblib'|cut -f1 -d'='`
COBPATHSTR=`env|grep 'coblib'|cut -f2 -d'='`
COBTEMPDIR=`grep 'TMPDIR=' $GENDIR/bin/startjobqueue|cut -f2 -d'='`
COBCOBSW=`grep 'COBSW=' $GENDIR/bin/startjobqueue|cut -f2 -d'='`

echo "   GENDIR: $GENDIR"          >> specs.txt
echo "  LADBDIR: $LADBDIR"         >> specs.txt
echo "   LAWDIR: $LAWDIR"          >> specs.txt
echo "   LAWIPC: $LAWIPC"          >> specs.txt
echo "   COBDIR: $COBDIR"          >> specs.txt
echo " PATH VAR: $COBPATHVAR"      >> specs.txt
echo " LIB PATH: $COBPATHSTR"      >> specs.txt

if test -n "$COBTEMPDIR"
then 
  echo "TMPDIR: $COBTEMPDIR"    >> specs.txt
fi

if test -n "$COBCOBSW"
then 
    echo "TMPDIR: $COBCOBSW"  >> specs.txt
fi

echo "UNIVERSE lawson.env"    		>> specs.txt
cat $LAWDIR/lawson.env             	>> specs.txt
echo "UNIVERSE ladb.cfg"    		>> specs.txt
cat $LAWDIR/system/ladb.cfg      	>> specs.txt


echo "UNIVERSE latm.cfg"    		>> specs.txt
cat $LAWDIR/system/latm.cfg 		>> specs.txt


echo "UNIVERSE lajs.cfg "    >> specs.txt
cat $LAWDIR/system/lajs.cfg 2>/dev/null        >> specs.txt

echo "UNIVERSE version information " >> specs.txt
echo "blddbdict: `univver blddbdict | cut -c17-`"    >> specs.txt
echo " dbcreate: `univver  dbcreate | cut -c17-`"    >> specs.txt
echo "  dbreorg: `univver   dbreorg | cut -c17-`"    >> specs.txt
echo "     ladb: `univver      ladb | cut -c17-`"    >> specs.txt
echo "   lafile: `univver    lafile | cut -c17-`"    >> specs.txt
echo "     latm: `univver      latm | cut -c17-`"    >> specs.txt
echo "     lajs: `univver      lajs | cut -c17-`"    >> specs.txt

if test -s $GENDIR/bin/unjs
then 
   echo "unjs: `univver   unjs | cut -c17-`"         >> specs.txt
fi

echo "lapm: `univver   lapm | cut -c17-`"            >> specs.txt

if test -s $GENDIR/bin/unpm
then 
    echo "     unpm: `univver   unpm | cut -c17-`"   >> specs.txt
fi

echo "    queue: `univver   queue| cut -c17-`"       >> specs.txt
echo "  execjob: `univver execjob| cut -c17-`"       >> specs.txt

if test -s $GENDIR/bin/ifxdb

then echo "    ifxdb: `univver  ifxdb | cut -c17-`"  >> specs.txt

fi

if test -s $GENDIR/bin/ifxdb5

then echo "   ifxdb5: `univver ifxdb5 | cut -c17-`"  >> specs.txt

fi

if test -s $GENDIR/bin/ifxdb7

then echo "   ifxdb7: `univver ifxdb7 | cut -c17-`"  >> specs.txt

fi

if test -s $GENDIR/bin/oradb

then echo "    oradb: `univver  oradb | cut -c17-`"  >> specs.txt

fi

if test -s $GENDIR/bin/oradb6
then 
    echo "   oradb6: `univver oradb6 | cut -c17-`"  >> specs.txt
fi

if test -s $GENDIR/bin/oradb7
then 
    echo "   oradb7: `univver oradb7 | cut -c17-`"  >> specs.txt
fi

if test -s $GENDIR/bin/sybdb
then 
     echo "    sybdb: `univver  sybdb | cut -c17-`"  >> specs.txt
fi

rngdbdump -n gen system -f PRODUCTLINE SYSTEMCODE RELEASEINFO   >> specs.txt