#!/QOpenSys/usr/bin/sh
#
# run_csvExce.sh <USERID> <File Trasfer Mode> <csv file name> or <bnd file name>
#

# =======================
# arg get
# -----------------------
if [ $# -ne 3 ]; then
   echo $1 $2 $3 $4
   echo "Usage: $0 <USERID> <File Transfer Mode> <csv or bnd fileName>"
   exit 1
fi

USER=$1
EXPORT=$2
FILENAME=$3

LOGF=`echo ${FILENAME} | sed -e 's/.CSV$/.LOG/' -e 's/.BND$/.LOG/'`
STSF=`echo ${FILENAME} | sed -e 's/.CSV$/.STS/' -e 's/.BND$/.STS/'`

sh -vx /opt/excel/run_csvExcel.sh ${USER} ${EXPORT} ${FILENAME} ${STSF} > ${LOGF} 2>> ${LOGF}

RTNCODE=$?
exit $RTNCODE
