Cover V06, I05
Article
Figure 1
Figure 2
Listing 1
Listing 2
Listing 3

may97.tar


Listing 3: Example shell script utilizing RSHSVC

#!/usr/bin/ksh
# loaddata.sh - condensed example version
# rsf - 11.13.1995    vBETA
# rsf - 12.28.1995    v1.0

# set up parameters
BASE=`basename ${0}`
TSTAMP=`date +%m%d%Y-%H%M%S`
LOGFILE=/tmp/${BASE}.${TSTAMP}.log
ERRFILE=/tmp/${BASE}.${TSTAMP}.err
LOGARCHIVE=/u/etc/${BASE}.log
ERRARCHIVE=/u/etc/${BASE}.err

exec 1> ${LOGFILE}
exec 2> ${ERRFILE}

echo "----- BEGIN ${BASE} RUN -----"
date +%Y%m%d:%H:%M:%S

# this binary processes the file downloaded from mainframe and
# creates three load files
echo "Starting COBOL parse...\c"
/u/local/bin/dataload.exe
echo DONE

# this section moves files to the NFS mount point, and also archives
# it exits on error in writing to /pubÖ
echo "Filename conversion...\c"
cp -p /dss/500/500d /pub/500/500d.txt
a=$?
cp -p /dss/500/500d /archive/500d.${TSTAMP}
gzip -9 /archive/500d.${TSTAMP} &

cp -p /dss/500/500v /pub/500/500v.txt
b=$?
cp -p /dss/500/500v /archive/500v.${TSTAMP}
gzip -9 /archive/500v.${TSTAMP} &

cp -p /dss/500/500m /pub/500/500m.txt
c=$?
cp -p /dss/500/500m /archive/500m.${TSTAMP}
gzip -9 /archive/500m.${TSTAMP} &

chk=`/sbin/expr $a + $b + $c`
if [ $chk -ne 0 ]
then
echo FAILED
exit 1
else
echo DONE
fi

# here is where we fire off three remote shells to the NT server for
# the ESSBASE scripts to load the databases.
# The .bat scripts reference the files on the logical P: drive of
# the NT server system to access the data previously copied to /pub
echo "\nMIDAS DATABASE LOAD"
echo "\nStarting update on commander DATA...\c"
remsh data01 'c:\users\default\utils\500d.bat'  &
remsh data01 'c:\users\default\utils\500m.bat' &
remsh data01 'c:\users\default\utils\500v.bat'
echo DONE


# wrap up...
date +%Y%m%d:%H:%M:%S
echo "----- END ${BASE} RUN -----"
cat ${LOGFILE} >> ${LOGARCHIVE}
cat ${ERRFILE} >> ${ERRARCHIVE} 2> /dev/null

# End of File