#!/bin/csh -f

#  123456789 12345
#  r_sfcG.f0918.gz


#  pgf90 -i8 -r8 ./r_a2dsfc.f
pgf90 -r8 -O2 -Mrecursive -Mdalign -DLINUX -byteswapio ./r_a2dsfc.f

foreach fil(  r_sfcG.f*[0-9].asc  )

  set cfil = `echo $fil | cut -c1-12`
  set cfil4 = `echo $fil | cut -c9-12`
  set cfil3 = `echo $fil | cut -c10-12`
  set cfil2 = `echo $fil | cut -c11-12`

  rm -f fort.*

  ln   -sf   $cfil\.asc   fort.21

if ( $cfil4 < 100 ) then
#  ln   -sf   $cfil\.dbl   fort.22
  ln   -sf   r_sfc.ft$cfil2   fort.22
else if ( $cfil4 < 1000 ) then
  ln   -sf   r_sfc.ft$cfil3   fort.22
else
  ln   -sf   r_sfc.ft$cfil4   fort.22
endif


./a.out

 ls -al ${fil}*
# exit

end



exit
