#!/bin/csh
#
#
cat <<+++

   Script to run program dataex.f

   It is assumed that program dataex.f is in the same directory
   as this script file.

+++
#
set dfilspec = '*.*'
set dchecknp = TRUE
set dparsit = TRUE
set dretdata = FALSE
set dprintit = FALSE
set ddbhead = TRUE
set dmname0 = "NDSC"
#
set gotit = no
while ( $gotit == no )
#
#  Obtain the absolute pathname for the files to be checked
#
   set noglob
   echo "Enter pathname for files to be checked ("$dfilspec"):"
   set filspec = $<
   if ( "$filspec" == "" )  set filspec = $dfilspec
   unset noglob
#
#  Define values for the logical variables used in program dataex.
#  Ensure that they are upper case.
#
   echo -n "Enter the value for checknp ("$dchecknp"):"
   set checknp = $<
   set checknp = `echo $checknp | tr '[a-z]' '[A-Z]'`
   if ( "$checknp" == "" )  set checknp = $dchecknp
#
   echo -n "Enter the value for parsit ("$dparsit"):"
   set parsit = $<
   set parsit = `echo $parsit | tr '[a-z]' '[A-Z]'`
   if ( "$parsit" == "" )  set parsit = $dparsit
#
   echo -n "Enter the value for retdata ("$dretdata"):"
   set retdata = $<
   set retdata = `echo $retdata | tr '[a-z]' '[A-Z]'`
   if ( "$retdata" == "" )  set retdata = $dretdata
#
   echo -n "Enter the value for printit ("$dprintit"):"
   set printit = $<
   set printit = `echo $printit | tr '[a-z]' '[A-Z]'`
   if ( "$printit" == "" )  set printit = $dprintit 
#
   echo -n "Enter the value for dbhead ("$ddbhead"):"
   set dbhead = $<
   set dbhead = `echo $dbhead | tr '[a-z]' '[A-Z]'`
   if ( "$dbhead" == "" )  set dbhead = $ddbhead
#
#  Define the standard mission name.
#
   echo "Enter the standard mission name ("$dmname0"):"
   set mname0 = $<
   if ( "$mname0" == "" )  set mname0 = "$dmname0"
#
#  See if the variables are named properly.
#
   set noglob
   cat <<+++

   pathname of files to check = $filspec
   checknp = $checknp
   parsit  = $parsit
   retdata = $retdata
   printit = $printit
   dbhead  = $dbhead
   mname0  = $mname0

+++
   unset noglob
   echo -n "Are these values ok (y)? "
   set yesno = $<
   if ( "$yesno" == y || "$yesno" == Y || "$yesno" == "" )  set gotit = yes
end
#
#  Create the file dataex.in.
#  This is done by writing the program control variables to dataex.in,
#  writing the list of pathnames to tmp1, and then concatenating the
#  two files.
#
#  Define a bogus name for the file ckctlz.dat.
#  Sun Fortran will read past ^Z so no need for a separate check.
#
set czpath = CKCTLZ.DAT
cat <<+++  > dataex.in
$checknp
$parsit
$retdata
$printit
$dbhead
$mname0
$czpath
+++
\ls -1 $filspec > tmp1$$
cat tmp1$$ >> dataex.in
#
#  Delete temporay files.
#
rm -f tmp1$$
#
#  Run program dataex.
#
dataex.exe <dataex.in >dataex.out
#
exit
