#!/bin/bash
# ************************************************************
# *
# * Name: INS0050
# *
# * Desc: Convert the MVSRES system residence to a CCKD
# *       volume.  This cannot be done earlier, as the
# *       stand alone utility gets somewhat confused
# *       by a compressed volume with alternate tracks
# *
# ************************************************************
PATH=../hercules:${PATH}
THISDIR=`pwd`
cd ..
GENDIR=`pwd`

cd ${THISDIR}
if ! test -d ../dasd
then
   mkdir ../dasd
fi
cd ../dasd
if ! test -f mvsres_n.148
then
   echo "The non-compressed dasd imnage file "
   echo "              mvsres_n.148          "
   echo "does not exist in the ${GENDIR}/dasd"
   echo "subdirectory.  Did you really run   "
   echo "installation script ins0020??       "
   echo " "
   echo "Press the enter to end this script"
   read dummy
else
   if test -f mvsres.148
   then
      rm -f mvsres.148
   fi
   if ! test -d ../log
   then
      mkdir ../log
   fi
   echo "Compressing mvsres_n.148"
   ckd2cckd -q mvsres_n.148 mvsres.148 >../log/ins0040.log
   cckdcdsk -3 mvsres.148 >>../log/ins0040.log
   if ! test -d ../snapshot
   then
      mkdir ../snapshot
   fi
   if test -f ../snapshot/mvsres_148_not_compressed
   then
      rm -f ../snapshot/mvsres_148_not_compressed
   fi
   tar -cvzf ../snapshot/mvsres_148_not_compressed.tgz mvsres_n.148
   rm -f mvsres_n.148
fi
