####  UNIX Script Documentation Block
#                .           .                                       .
# Script name:   ingest_snowetoa.sh
# Purpose    :   To convert binary EBCDIC snow cover to text ASCII file
#
# JIF contact:  Katz        org: NP2         date: 97-01-07
#
# Abstract: ingest_snowetoa.sh is a special purpose script that converts the
#   snow cover file from the CEMSCS to a readable form on the CRAY.
#   The UNIX command dd is invoked
#   to convert an EBCDIC file to an ASCII text file.
#
# Script history log:
#   97-01-07  Bert Katz   original version for implementation
#   97-06-20  Bert Katz   Removed executable and replaced it by
#                         CRAY commands to do the same thing
#
# Usage: ingest_snowetoa.sh
#
#   Script parameters: None
#
#   Modules and files referenced:
#     scripts    : none
#     executables: none
#
# Remarks:
#
#   Invoked by the script ingest_process_days.
#   Variables ndayarch, TANKDIR, EXECDIR and EXECUTE must be set.
#   For details of usage, see docblock in ingest_process_newdays
#
#   Condition codes:
#     0     - no problem encountered
#     not 0 - some problem encountered
#
# Attributes:
#
#   Language: /bin/sh script
#   Machine:  IBM SP
####
if [ $DEBUGSCRIPTS = ON -o $DEBUGSCRIPTS = YES ] ; then
  set -x
fi
if [ -s PRD.GOESNET.SNOW.INTEGRPH ] ; then
   dd if=PRD.GOESNET.SNOW.INTEGRPH of=goes.snow.integrph.text conv=ascii cbs=80
   snowrc=$?
   if [ $snowrc -eq 0 ] ; then
      echo "ENDOF FILE" >> goes.snow.integrph.text
      mv goes.snow.integrph.text PRD.GOESNCEP.SNOW.INTEGRPH
   fi
   exit $snowrc
fi
