#!/bin/ksh -x
#
#
# Verifica se foi passado algum parametro
hostname
export hh=${1}
if (($#<5)) ; then
export Run_Date=`date "+"%Y%m%d"`${hh}
else
export Run_Date=${5}${hh}
fi

# VARIAVEIS
export FInitBC=Eta_ams_08km
export Dir_home=`pwd`
export Dir_scr=${Dir_home}
export Dir_util=${Dir_home}/../util
export ifct=${2}
export Fct=${3}
export InitBC=${4}


cd ${Dir_scr}

typeset -Z3 ifct ftime Fct


export data_grib=${Dir_home}/../ams_08km/${Run_Date}/GRBCTL

echo "${FInitBC} DATA  " ${Run_Date}

    
fpref=${FInitBC}_${Run_Date}
ftime=${ifct}

    
while ((ftime<=${Fct})) ; do
  datefct=`caldate.3.0 ${Run_Date} + ${ftime}hr 'yyyymmddhh'`
  ifile=${fpref}_${datefct} 
  rm -f  ${data_grib}/${ifile}*
  let ftime=$ftime+$InitBC
done

exit 
   
   
