#!/bin/csh
#
cd /roy/p1/sybase/cdbs/final
#
# update
#
echo "+++++++++++++++++++++++++++++++"
echo "+++++++ starting update +++++++"
echo "+++++++++++++++++++++++++++++++"
#
set INSTRUMENT_LIST = (foc fos hrs hsp nic stis wfpc wfpc2)
while $#INSTRUMENT_LIST
setenv CURRENT_INSTRUMENT $INSTRUMENT_LIST[1]
date
echo "processing ${CURRENT_INSTRUMENT}"
isql -Usa -w132 -SCATLOG -e << eof
use dadsops
go
update_${CURRENT_INSTRUMENT}
go
exit
eof
shift INSTRUMENT_LIST
end
date
#
# new
#
echo "+++++++++++++++++++++++++++++++"
echo "+++++++++ starting new ++++++++"
echo "+++++++++++++++++++++++++++++++"
#
isql -Usa -w132 -SCATLOG << eof
use cdbs_ops
go
update new_cal_files set timestmp = getdate()
go
exit
eof
set INSTRUMENT_LIST = (foc fos hrs hsp nic stis wfpc wfpc2)
while $#INSTRUMENT_LIST
setenv CURRENT_INSTRUMENT $INSTRUMENT_LIST[1]
date
echo "processing ${CURRENT_INSTRUMENT}"
isql -Usa -w132 -SCATLOG -e << eof
use dadsops
go
new_${CURRENT_INSTRUMENT}
go
exit
eof
shift INSTRUMENT_LIST
end
date
#
#
#
isql -Usa -w132 -SCATLOG << eof
use cdbs_ops
go
insert into new_cal_files_history select instrument,file_name,expansion_number,getdate(),timestmp from new_cal_files
where timestmp is not null
go
delete from new_cal_files where timestmp is not null
go
exit
eof
#
#
set mdy_HM = `date '+%m%d%y_%H%M'`
mv daily_best_ref.log daily_best_ref.log.$mdy_HM 
