#!/bin/csh -x
#----------------------------------------------------------------------
#
#       getkw.com
#
#       script to create an observation-specific keyword file.
#       In the final sample pipeline this will be a
#       grep opus_data_dir/kwdb $obs_root
#       but for now all we do is copy a constant set.
#
#--------------------------------------------------------------------
#                          REVISION HISTORY
#--------------------------------------------------------------------
#  MOD             PR
# LEVEL   DATE   NUMBER  User  Description
# ----- -------- ------  ------ -------------------------------------
#
#  001  06/20/97 34299   Rose   Creation
#  002  08/29/97 35137   Rose   removed .cshrc loggin
#  003  02/20/98 35847   WMiller Set redirections for noclobber
#
#----------------------------------------------------------------------
#
echo " "
echo "`date`"
echo "---------------- Starting GETKW ----------------------------" >>! $OUTPATH/$OSF_DATASET.trx
echo "`date`" >>! $OUTPATH/$OSF_DATASET.trx

# search database for keyword info
grep $OSF_DATASET $OPUS_DB_DIR/gif_keyword.database >! $OUTPATH/$OSF_DATASET.dbx
set savestat = $status
if ( $savestat == 1 ) then
    echo "ERROR: unable to find any keywords in $OPUS_DB_DIR/gif_keyword.database" >>! $OUTPATH/$OSF_DATASET.trx
else
    echo "SUCCESS retrieving keywords from $OPUS_DB_DIR/gif_keyword.database" >>! $OUTPATH/$OSF_DATASET.trx
endif
echo "---------------- Ending GETKW ------------------------------" >>! $OUTPATH/$OSF_DATASET.trx
echo " "
exit $savestat
