#!/bin/ksh
if [ $# = 0 ]
then
  echo "DEL: ERROR invalid parameter"
  exit 1
fi
jobfile=`ftval $1 MASTERCAT 4`
if [ "a$jobfile" = "a" ]
then
  echo "DEL: ERROR dataset $1 not found in File_Map"
  exit 1
fi
if [ ! -f $jobfile ]
then
  echo "DEL: ERROR file $jobfile not found"
  exit 1
fi
cd $JCLLIB/..
SUBMITCARD=./SUBMIT.`basename $jobfile`.$JON
if [ -f $SUBMITCARD ]
then
  sh $SUBMITCARD
  rm -f $SUBMITCARD
  exit 0
else
  echo "DEL: ERROR file $SUBMITCARD not found"
  echo "DEL: ERROR mising SUBMIT statement for job $1"
  exit 1
fi
exit 0
