#!/bin/tcsh -fx
##########################################################################
#
# routine: gtgeis
#
# purpose: Update OSF to show GEIS files were recieved
#
# modification history:
#
#   date    opr     who     reason
# -------- -----  --------  --------------------------------------
# 09/07/00 42386   Heller     Created
# 08/21/01 43913_03 MSwam     Shorten variable names for Solaris
# 09/10/12 70213   MSwam      use tcsh
#
##########################################################################
set banner=">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
echo $banner
\date
#
set go_absent = 102             # exit status is in the FATAL range for XPOLL
set badnews = 1    # exit status is mapped to dataset error
set all_is_well = 0 # exit status for successful processing
#
set filename = `basename $EVENT_NAME`
set obname = `echo $filename:r`
#
# Just to be safe use the data_id (wf2 or foc) when updating the OSF
#
set firstchar = `echo $obname | awk '{a=substr($1,1,1);  print a}'`
if ( $firstchar =~ 'x' ) then
  set dataid = 'foc'
else
  set dataid = 'wf2'
endif 
#
osf_update -p $PATH_FILE -f $obname -t $dataid -c $THIS_STEP -s $THIS_VALUE -c $NEXT_STEP -s $NEXT_VALUE
if ($status != 0) then
  echo "WARNING: failed to update OSF for $obname"
  exit $badnews
endif
exit $all_is_well 
