How can I pass more than one vatiable to a function? Here is the code. Thanks
SOURCEDIR=/us1/ximport
RESULTDIR=/us1/ximport/result
RPTDATETIME=$(date +%Y-%m-%d_%H.%M.%S)
TEST=NO
OPERATOR=exp
PRACFILE=111111111111111111111111111111111111111111111111111111111111
GPMSDIR=/gpms
PRACNAME='
xpc
thr'
function import_practice
{
# If no source file exists for the practice, write a norecords.txt file to the result directory and exit.
if [[ ! -f ${SOURCEDIR}/target_${PRACNAME}.txt ]]
then
echo '0 records specified' > ${RESULTDIR}/${PRACNAME}_${RPTDATETIME}_norecords.txt
exit 1
fi
# Stream the template .ini file to a copy for the practice, replacing the literals '$PRACNAME', '$SOURCEDIR'
# and $RESULTDIR in the with their corresponding variable values.
sed -e s:'$PRACNAME':${PRACNAME}:g ximport_template.ini |
sed -e s:'$TEST':${TEST}:g |
sed -e s:'$SOURCEDIR':${SOURCEDIR}:g |
sed -e s:'$RPTDATETIME':${RPTDATETIME}:g |
sed -e s:'$RESULTDIR':${RESULTDIR}:g > ${SOURCEDIR}/ximport_${PRACNAME}.ini
# Run Ximport for the practice.
#${GPMSDIR}/ximport ${SOURCEDIR}/ximport_${PRACNAME}.ini
#Delete the source file and .ini file.
#rm ${SOURCEDIR}/target_${PRACNAME}.txt
#rm ${SOURCEDIR}/ximport_${PRACNAME}.ini
#Spool the result files to GPMS printer management.
${GPMSDIR}/mkspl -sc -n260 -p${PRACNAME} -t 'ximport Err Rpt' ${RESULTDIR}/${PRACNAME}_${RPTDATETIME}_errors.txt
${GPMSDIR}/mkspl -sc -n260 -p${PRACNAME} -t 'ximport Warn Rpt' ${RESULTDIR}/${PRACNAME}_${RPTDATETIME}_warnings.txt
${GPMSDIR}/mkspl -sc -n260 -p${PRACNAME} -t 'ximport Stat Rpt' ${RESULTDIR}/${PRACNAME}_${RPTDATETIME}_status.txt
${GPMSDIR}/mkspl -sc -n260 -p${PRACNAME} -t 'ximport Bad Rpt' ${RESULTDIR}/${PRACNAME}_${RPTDATETIME}_bad.txt
}
for practice in $PRACNAME
do
import_practice "$practice"
done
SOURCEDIR=/us1/ximport
RESULTDIR=/us1/ximport/result
RPTDATETIME=$(date +%Y-%m-%d_%H.%M.%S)
TEST=NO
OPERATOR=exp
PRACFILE=111111111111111111111111111111111111111111111111111111111111
GPMSDIR=/gpms
PRACNAME='
xpc
thr'
function import_practice
{
# If no source file exists for the practice, write a norecords.txt file to the result directory and exit.
if [[ ! -f ${SOURCEDIR}/target_${PRACNAME}.txt ]]
then
echo '0 records specified' > ${RESULTDIR}/${PRACNAME}_${RPTDATETIME}_norecords.txt
exit 1
fi
# Stream the template .ini file to a copy for the practice, replacing the literals '$PRACNAME', '$SOURCEDIR'
# and $RESULTDIR in the with their corresponding variable values.
sed -e s:'$PRACNAME':${PRACNAME}:g ximport_template.ini |
sed -e s:'$TEST':${TEST}:g |
sed -e s:'$SOURCEDIR':${SOURCEDIR}:g |
sed -e s:'$RPTDATETIME':${RPTDATETIME}:g |
sed -e s:'$RESULTDIR':${RESULTDIR}:g > ${SOURCEDIR}/ximport_${PRACNAME}.ini
# Run Ximport for the practice.
#${GPMSDIR}/ximport ${SOURCEDIR}/ximport_${PRACNAME}.ini
#Delete the source file and .ini file.
#rm ${SOURCEDIR}/target_${PRACNAME}.txt
#rm ${SOURCEDIR}/ximport_${PRACNAME}.ini
#Spool the result files to GPMS printer management.
${GPMSDIR}/mkspl -sc -n260 -p${PRACNAME} -t 'ximport Err Rpt' ${RESULTDIR}/${PRACNAME}_${RPTDATETIME}_errors.txt
${GPMSDIR}/mkspl -sc -n260 -p${PRACNAME} -t 'ximport Warn Rpt' ${RESULTDIR}/${PRACNAME}_${RPTDATETIME}_warnings.txt
${GPMSDIR}/mkspl -sc -n260 -p${PRACNAME} -t 'ximport Stat Rpt' ${RESULTDIR}/${PRACNAME}_${RPTDATETIME}_status.txt
${GPMSDIR}/mkspl -sc -n260 -p${PRACNAME} -t 'ximport Bad Rpt' ${RESULTDIR}/${PRACNAME}_${RPTDATETIME}_bad.txt
}
for practice in $PRACNAME
do
import_practice "$practice"
done