####  UNIX Script Documentation Block
#                .           .                                       .
# Script name:   combfr      Combine blocked BUFR files
#
# JIF contact:  Woollen     org: w/nmc2      date: 96-12-11
#
# Abstract: The combfr script combines (concatentes) up to thirty BUFR
#           files into one. Although the UNIX cat command will successully
#           combine byte string (-Fsystem) files, blocked files (-Fcos)
#           require special treatment, at least on the Crays. The script
#           uses the operational dump executable, combfr.xc(.x), to do
#           the combining.
#
# Script history log:
#   96-12-11  J. Woollen  original version for implementation
#   00-01-21  L. Sager    converted to the IBM SP
#   01-01-18  G. Fulwood  Moved a version of this script to $scripts/combfr.sh
#                         on sgi102 for a backup copy.
#
# Usage: combfr <input1> <input2> <input3> ... <inputN> <output>
#
#   Script parameters:
#     <inputn>   - list of input path/filenames to combine
#     <output>   - the BUFR output path/filename
#
#
#   Imported Shell Variables:
#
#     These will be set to their default value in this script if not
#      exported to this script by the parent script --
#
#
#
#   Modules and files referenced:
#     scripts    : none
#     data cards : none
#     executables: bufr_combfr
#
# Remarks:
#
#   Note: 1) All files are assumed to have the same BUFR tables
#
#   Condition codes:
#     00 - no problem encountered
#     99 - parameter problem
#
# Attributes:
#
#   Language: script
#   Machine:  IBM SP
#
####
 
 
if [ $# -lt 2 ]
then
echo
echo "combfr will concatenate BUFR files"
echo
echo "Usage: combfr <input1> <input2> <input3> ... <inputN> <output>"
echo
echo "Note: 1) All files are assumed to have the same BUFR tables"
echo
exit 99
fi
      
export XLFRTEOPTS="unit_vars=yes"     # Allow overriding default names.
 
COMX=/nwprod/exec/bufr_combfr
COMI=combfr.in; >$COMI
COMO=combfr.out
 
while [ $# -gt 1 ]
do
echo $1 >> $COMI
shift
done
 

   export XLFUNIT_50="$1"
   cat $COMI|$COMX>$COMO 2>&1
 
