#!/bin/csh
#
# Name: search_size_csh
#
# Description: This script looks for the pre compressed size of
#              the archived reference file.
#
# call:        To call this script you should type 
#
#              ./search_size_csh NEWNAME
#
#              where NEWNAME is the common characters in the file 
#              names to search. NAME should be in caps.
#
# Requires:    setenv DSQUERRY GUMMO
#------------------------------------------------------------------------

#Reference file root name to search
set ENTERFILE=$1

if ($ENTERFILE == "") then
   echo "Give the commun characters of the filename to search (USE CAPS):"
   set ENTERFILE = $<
endif

echo "New file name to search $ENTERFILE"

#removing old size_query.sql
/bin/rm -f ~/bin/size_query.sql

#Writes SQL commsnds to a file 
echo "use dadsops" >> ~/bin/size_query.sql
echo "go" >> ~/bin/size_query.sql
echo "select afi_data_set_name,afi_pre_compress_size from archive_files where afi_data_set_name like" >> ~/bin/size_query.sql

echo \'$ENTERFILE%\' >> ~/bin/size_query.sql
echo "go" >> ~/bin/size_query.sql
echo ""
echo "Searching the database"
echo ""

isql -e -i ~/bin/size_query.sql -S GUMMO
