#!/bin/sh
export member=faxairplt.sh
USAGE="usage: $member faxfile cards pass55 passcards"
DATE="$member 2000-01-20 10:10L "
VERS="Starting: ${USHutil}/${DATE}"
#
#__________________________________________________________________________
# NAME     : faxairplt.sh
# Author   : Peter Henrichsen
# Purpose  : This script runs the apfaxanl program to make 4 fax charts. 
#          : 
# History  : 97-06-19 Peter Henrichsen
#            97-11-20 Peter Henrichsen modify to fix jlogfile messages.
#            98-09-10 Peter Henrichsen modify for y2k testing
#            98-11-17 Peter Henrichsen modify to send the maps to an Hp
#            printer.
#           :1999-07-19 Peter Henrichsen modify to run on IBM SP.
#           :2000-01-20 Peter Henrichsen modify to pass sndfrc to script
#            snd2forgn and to use USHutil                     
#           :2005-08-31 Steve Lilly remove to pass sndfrc to script and
#            changes 6bit format to T4.
#
# Location : This script is found on hp36 as:
#          : /tmp_mnt/export/sgi73/peterhen/util/scripts/ibm/faxairplt.sh
#          : & on ncosp as :
#          : /nwprod/util/ush/faxairplt.sh
#          : /nfsuser/g02/wx12ph/util/ush/faxairplt.sh           
#
# Usage    : This script runs in both cycles of job 314.
#
# Arguments: faxfile    - output fax filename
#            cards      - input data cards file in PARMgraph
#            pass55     - the passed label file from previous step
#            passcards  - the passed card file from previous step
#_________________________________________________________________________
#
cd $DATA 

print "$USAGE"
print "$VERS"

num=$#
if test $num -ne 4
then
  echo "You need 4 input variables."
  err_exit
fi 
postmsg  "$jlogfile" "$VERS"
set -x
faxfile=$1
cards=$2
pass55=$3
passcards=$4

echo faxfile=$faxfile
echo cards=$cards
echo pass55=$pass55
echo passcards=$passcards

pgm=apfaxanl

export pgm; prep_step
export XLFRTEOPTS="unit_vars=yes"
cp $FIXutil/graph_gphbg/nh2501.pur nh2501.pur

#   input files.

export XLFUNIT_16="$PARMutil/$cards"          # control cards
export XLFUNIT_28="$DATA/$passcards"           # passed card file
export XLFUNIT_54="$DATA/$pass55"              # passed label file
export XLFUNIT_41="$DATA/nh2501.pur"           # map background file

#   out put files
export XLFUNIT_02="$DATA/label02"
export XLFUNIT_45="$DATA/label45" 
export XLFUNIT_55="$DATA/label55"
export XLFUNIT_60="$DATA/label60"
export XLFUNIT_61="$DATA/label61"
export XLFUNIT_62="$DATA/label62"
export XLFUNIT_63="$DATA/label63"
export XLFUNIT_71="$DATA/ras71"
export XLFUNIT_72="$DATA/rasst72"
export XLFUNIT_75="$DATA/apanalmsg.$pid"      # the consol message file.
export XLFUNIT_80="$DATA/ext6b80" 
export XLFUNIT_81="$DATA/$faxfile"            # the completed fax maps    

startmsg

$EXECutil/apfaxanl PARM="N" >> $pgmout  2> errfile


jobn=${RUN}.${cyc}
FAXOUT=$faxfile

for KEYW in FREEZLEV FREEZL_g FREEZL_p AVGRELHU AVGREL_g AVGREL_p LI_KINDX LIKIDX_g LIKIDX_p PPT_PCNT PPT_PC_g PPT_PC_p
do
 
 grep $KEYW $FIXutil/identifyfax.tbl | read Keyword sub00 sub06 sub12 sub18 gif toc prt lprt name
 
  if [ ${cyc} = '00' ]; then submn=$sub00; fi
  if [ ${cyc} = '12' ]; then submn=$sub12; fi
 
 export FAXOUT submn name Keyword gif toc prt jobn lprt
 $utilscript/mk_graphics.sh

done

echo " "
echo "Leaving shell script $member"
echo " "

