#!/bin/sh #set -x USAGE="usage:widemap [-a file] [-n ssno] [-x width] [-p prntr] [-d dots] [-c #]" DATE="2000-02-10 1055L" #______________________________________________________________________________ # NAME : widemap # Author : Peter Henrichsen # Purpose : This script is called to convert a NMC 6-bit packed chart # : into HP printable format. # : I uses program graph_widemap to decode the NMC 6-bit packed # : chart into pure-raster format. # : Then program graph_dispuras converts the pure-raster file # : into a pcl file. # : This pcl file is then sent to an 11X17 HP printer in the WWB! # # History : 99-03-11 Peter Henrichsen # : 1999-12-01 Peter Henrichsen modify to run on the ncosp # : 1999-12-14 Peter Henrichsen modify to call script print_pcl # : to send the compled pcl file to the printers via dbnet. # : 2000-02-09 Peter Henrichsen modify remove "graph_" from # name of graph_widemap and graph_dispuras. # : 2000-02-10 Peter Henrichsen modify to call widemap rather # than wide_map. Added some error checking logic. Changed # "JOB" to job! # # Location : This script is found on hp36 as: # : /tmp_mnt/export/sgi73/peterhen/util/scripts/ibm/widemap # : on ncosp as: # : /nfsuser/g02/wx12ph/util/ush/widemap or # /nwprod/util/ush/widemap # # AN EXAMPLE: widemap -a file -n 115 -x 2048 -p dataman2 -d 200 -c 1 # # "file" is faxfile fullpath. # "115" is the subset number of the map to get from "file". # "2048" is the width of map in pixsels. # "dataman2" is the HP printer name. # "200" is dots per inche. # "1" is the number of copies to make. # #_______________________________________________________________________________ # integer istat istat=0 if [ -z "$DATA" ] ; then whatdir=$LOGNAME DATA=/tmp/$whatdir export DATA mkdir -m 775 -p $DATA >/dev/null 2>&1 fi cd $DATA # ------------------------------------------------------------------ # ... try command line args with key codes ... # ... widemap -a filename.pk6 -n 115 -x 2048 # ... initializ to default values ... finam=" " ssnum=999 widpxl=4224 # ... fetch command line arguments ....... while getopts :a:n:x:p:d:c: arguments do case $arguments in a) finam=$OPTARG;; #... filename of NMC 6-bit packed n) ssnum=$OPTARG;; #... subset number x) widpxl=$OPTARG;; #... width in pixels p) lprntr=$OPTARG;; #... printer name d) dots=$OPTARG;; #... dots per inche c) numcp=$OPTARG;; #... number of copies :) print "You forgot to enter a value for $OPTARG" print "$USAGE" istat=8 exit $istat;; \?) print "OPTARG is not a valid switch." print "$USAGE" istat=8 exit $istat;; esac done finamras=ras.$ssnum.$pid finamcrd=crd.$ssnum.$pid finampcla=pcla.$ssnum.$pid finampclb=pclb.$ssnum.$pid finampclc=pclc.$ssnum.$pid finampcld=pcld.$ssnum.$pid finampcle=pcle.$ssnum.$pid finampclf=pclf.$ssnum.$pid print "INPUT filename = $finam" print "Subset Number of desired product = $ssnum" print "Width of display in pixels = $widpxl" print "Output printer is = $lprntr" print "Dots per inche = $dots" print "Number of copies=$numcp" # ------------------------------------------------------------------ ((widbyt = (widpxl +7) / 8)) if ((widbyt > 528)) then widbyt=528 elif ((widbyt < 56)) then widbyt=56 fi if ((widbyt > 256)) then ltwosideqq=1 widatl=256 ((widpac = widbyt-256)) if ((widpac > 256)) then widpac=256 fi else ltwosideqq=0 ((widatl = widbyt)) widpac=0 fi # ------------------------------------------------------------------ # ... finam=$1 # ... parmsg="ssno="$2,pels=4224 parmsg="ssno="$ssnum,pels=4224 if [[ -a $finam ]] then # ... NMC 6bit packed file exists ... print "Given NMC6bitpacked = $finam " pgm=widemap export pgm; prep_step # ... so decode the map # set -x export XLFRTEOPTS="unit_vars=yes" export XLFUNIT_66="$finamras" # in cards export XLFUNIT_67="$finamcrd" # out card export XLFUNIT_75="$DATA/widemap.$ssnum.msg.$pid" # the consol message file. startmsg # /nwprod/util/exec/widemap $finam \ # parm=$parmsg 2>> errfile $EXECutil/widemap $finam \ parm=$parmsg 2> errfile # parm='ssno=3786' 2>> errfile istat=$? echo widemap: Ended with return code = $istat if ((istat == 0)) then err=$?;export err; err_chk print " . . . . . . no errors." ls -l $finam ls -l $finamras ls -l $finamcrd # check to see if this map had a ifid title. grep -i Faxmap $DATA/widemap.$ssnum.msg.$pid >whatis kstat=$? if test "$kstat" = 0 then export ifid=`grep -i Faxmap $DATA/whatis \ | awk '{for(i=5;i<=NF;i++) printf("%s ", $i)}'` else echo "widemap: missg ifid array" export ifid="MAP IFID MISSING" fi rm $DATA/whatis else print "error, $istat " exit $istat fi # ... set +x else print "Error. NMC6bit-File is non-existent: $finam " print "$USAGE" istat=2 exit $istat #... STOP on NO INPUT file # fi #... ENDIF #------------------------------------------------------------------- wname=widemap export member=print_pcl export wname pgm=dispuras export pgm; prep_step length=`cut -c37-40 $finamcrd` if test $dots -eq 300 then # this is a special cut for tropical maps to get on one 11X17 page. len=$length parmcuta="lrecl=528,byskp=1,byshw=366,lnskp=0,lnshw="$len",dotpi="$dots",swaby=0,hdrby=0,large=1,nogrd=1" export XLFRTEOPTS="unit_vars=yes" export XLFUNIT_75="$DATA/dispuras.$ssnum.msg.$pid" # the consol message file. startmsg $EXECutil/dispuras $finamras $finampcla \ parm=$parmcuta 2>> errfile err=$?;export err; err_chk set -x i=$numcp while [ "$i" -ge 1 ] do # copy the pcl file into pcom cp $finampcla $pcom/pcla.$ssnum.$job sndpcl=0 echo $sndpcl >$DATA/sndpcl $USHutil/$member $pcom/pcla.$ssnum.$job "$ifid" "$ssnum" read sndpcl < $DATA/sndpcl if test $sndpcl -eq '0' then msgs="PCLFILE $ifid WAS SENT TO $lprntr VIA DBNET!" else msgs="ERROR $ifid WAS NOT SENT TO $lprntr!" fi postmsg "$jlogfile" "$msgs" let i=$i-1 done set +x else if ((length <= 3200)) then # ... single set ... len=$length parmcuta="lrecl=528,byskp=0,byshw="$widatl",lnskp=0,lnshw="$len",dotpi="$dots",swaby=0,hdrby=0,large=1,nogrd=1" export XLFRTEOPTS="unit_vars=yes" export XLFUNIT_75="$DATA/dispuras.$ssnum.msg.$pid" # the consol message file. startmsg $EXECutil/dispuras $finamras $finampcla \ parm=$parmcuta 2>> errfile err=$?;export err; err_chk set -x i=$numcp while [ "$i" -ge 1 ] do # copy the pcl file into pcom cp $finampcla $pcom/pcla.$ssnum.$job sndpcl=0 echo $sndpcl >$DATA/sndpcl $USHutil/$member $pcom/pcla.$ssnum.$job "$ifid" "$ssnum" read sndpcl < $DATA/sndpcl if test $sndpcl -eq '0' then msgs="PCLFILE $ifid WAS SENT TO $lprntr VIA DBNET!" else msgs="ERROR $ifid WAS NOT SENT TO $lprntr!" fi postmsg "$jlogfile" "$msgs" let i=$i-1 done set +x if ((ltwosideqq == 1)) then parmcutb="lrecl=528,byskp=250,byshw="$widpac",lnskp=0,lnshw="$len",dotpi="$dots",swaby=0,hdrby=0,large=1,nogrd=1" export XLFRTEOPTS="unit_vars=yes" export XLFUNIT_75="$DATA/dispuras.$ssnum.msg.$pid" # the consol message file. startmsg $EXECutil/dispuras $finamras $finampclb \ parm=$parmcutb 2>> errfile err=$?;export err; err_chk set -x i=$numcp while [ "$i" -ge 1 ] do # copy the pcl file into pcom cp $finampclb $pcom/pclb.$ssnum.$job sndpcl=0 echo $sndpcl >$DATA/sndpcl $USHutil/$member $pcom/pclb.$ssnum.$job "$ifid" "$ssnum" read sndpcl < $DATA/sndpcl if test $sndpcl -eq '0' then msgs="PCLFILE $ifid WAS SENT TO $lprntr VIA DBNET!" else msgs="ERROR $ifid WAS NOT SENT TO $lprntr!" fi postmsg "$jlogfile" "$msgs" let i=$i-1 done set +x fi # ------------------------------------------------------------- elif ((length >3200)) && ((length <= 6400)) then # ... two sets ... len=3200 parmcuta="lrecl=528,byskp=0,byshw="$widatl",lnskp=0,lnshw="$len",dotpi="$dots",swaby=0,hdrby=0,large=1,nogrd=1" export XLFRTEOPTS="unit_vars=yes" export XLFUNIT_75="$DATA/dispuras.$ssnum.msg.$pid" # the consol message file. startmsg $EXECutil/dispuras $finamras $finampcla \ parm=$parmcuta 2>> errfile err=$?;export err; err_chk set -x i=$numcp while [ "$i" -ge 1 ] do # copy the pcl file into pcom cp $finampcla $pcom/pcla.$ssnum.$job sndpcl=0 echo $sndpcl >$DATA/sndpcl $USHutil/$member $pcom/pcla.$ssnum.$job "$ifid" "$ssnum" read sndpcl < $DATA/sndpcl if test $sndpcl -eq '0' then msgs="PCLFILE $ifid WAS SENT TO $lprntr VIA DBNET!" else msgs="ERROR $ifid WAS NOT SENT TO $lprntr!" fi postmsg "$jlogfile" "$msgs" let i=$i-1 done set +x if ((ltwosideqq == 1)) then parmcutb="lrecl=528,byskp=250,byshw="$widpac",lnskp=0,lnshw="$len",dotpi="$dots",swaby=0,hdrby=0,large=1,nogrd=1" export XLFRTEOPTS="unit_vars=yes" export XLFUNIT_75="$DATA/dispuras.$ssnum.msg.$pid" # the consol message file. startmsg $EXECutil/dispuras $finamras $finampclb \ parm=$parmcutb 2>> errfile err=$?;export err; err_chk set -x i=$numcp while [ "$i" -ge 1 ] do # copy the pcl file into pcom cp $finampclb $pcom/pclb.$ssnum.$job sndpcl=0 echo $sndpcl >$DATA/sndpcl $USHutil/$member $pcom/pclb.$ssnum.$job "$ifid" "$ssnum" read sndpcl < $DATA/sndpcl if test $sndpcl -eq '0' then msgs="PCLFILE $ifid WAS SENT TO $lprntr VIA DBNET!" else msgs="ERROR $ifid WAS NOT SENT TO $lprntr!" fi postmsg "$jlogfile" "$msgs" let i=$i-1 done set +x fi # ------------------------------------------------------------- # ... for page2, in order to overlap with page1 if possible, ((hundreds = ((length + 99) / 100) * 100)) ((skp = hundreds - 3200)) ((len = length - skp)) parmcutc="lrecl=528,byskp=0,byshw="$widatl",lnskp="$skp",lnshw="$len",dotpi="$dots",swaby=0,hdrby=0,large=1,nogrd=1" export XLFRTEOPTS="unit_vars=yes" export XLFUNIT_75="$DATA/dispuras.$ssnum.msg.$pid" # the consol message file. startmsg $EXECutil/dispuras $finamras $finampclc \ parm=$parmcutc 2>> errfile err=$?;export err; err_chk set -x i=$numcp while [ "$i" -ge 1 ] do # copy the pcl file into pcom cp $finampclc $pcom/pclc.$ssnum.$job sndpcl=0 echo $sndpcl >$DATA/sndpcl $USHutil/$member $pcom/pclc.$ssnum.$job "$ifid" "$ssnum" read sndpcl < $DATA/sndpcl if test $sndpcl -eq '0' then msgs="PCLFILE $ifid WAS SENT TO $lprntr VIA DBNET!" else msgs="ERROR $ifid WAS NOT SENT TO $lprntr!" fi postmsg "$jlogfile" "$msgs" let i=$i-1 done set +x if ((ltwosideqq == 1)) then parmcutd="lrecl=528,byskp=250,byshw="$widpac",lnskp="$skp",lnshw="$len",dotpi="$dots",swaby=0,hdrby=0,large=1,nogrd=1" export XLFRTEOPTS="unit_vars=yes" export XLFUNIT_75="$DATA/dispuras.$ssnum.msg.$pid" # the consol message file. startmsg $EXECutil/dispuras $finamras $finampcld \ parm=$parmcutd 2>> errfile err=$?;export err; err_chk set -x i=$numcp while [ "$i" -ge 1 ] do # copy the pcl file into pcom cp $finampcld $pcom/pcld.$ssnum.$job sndpcl=0 echo $sndpcl >$DATA/sndpcl $USHutil/$member $pcom/pcld.$ssnum.$job "$ifid" "$ssnum" read sndpcl < $DATA/sndpcl if test $sndpcl -eq '0' then msgs="PCLFILE $ifid WAS SENT TO $lprntr VIA DBNET!" else msgs="ERROR $ifid WAS NOT SENT TO $lprntr!" fi postmsg "$jlogfile" "$msgs" let i=$i-1 done set +x fi else # ... three sets ... len=3200 parmcuta="lrecl=528,byskp=0,byshw="$widatl",lnskp=0,lnshw="$len",dotpi="$dots",swaby=0,hdrby=0,large=1,nogrd=1" export XLFRTEOPTS="unit_vars=yes" export XLFUNIT_75="$DATA/dispuras.$ssnum.msg.$pid" # the consol message file. startmsg $EXECutil/dispuras $finamras $finampcla \ parm=$parmcuta 2>> errfile err=$?;export err; err_chk set -x i=$numcp while [ "$i" -ge 1 ] do # copy the pcl file into pcom cp $finampcla $pcom/pcla.$ssnum.$job sndpcl=0 echo $sndpcl >$DATA/sndpcl $USHutil/$member $pcom/pcla.$ssnum.$job "$ifid" "$ssnum" read sndpcl < $DATA/sndpcl if test $sndpcl -eq '0' then msgs="PCLFILE $ifid WAS SENT TO $lprntr VIA DBNET!" else msgs="ERROR $ifid WAS NOT SENT TO $lprntr!" fi postmsg "$jlogfile" "$msgs" let i=$i-1 done set +x if ((ltwosideqq == 1)) then parmcutb="lrecl=528,byskp=250,byshw="$widpac",lnskp=0,lnshw="$len",dotpi="$dots",swaby=0,hdrby=0,large=1,nogrd=1" export XLFRTEOPTS="unit_vars=yes" export XLFUNIT_75="$DATA/dispuras.$ssnum.msg.$pid" # the consol message file. startmsg $EXECutil/dispuras $finamras $finampclb \ parm=$parmcutb 2>> errfile err=$?;export err; err_chk set -x i=$numcp while [ "$i" -ge 1 ] do # copy the pcl file into pcom cp $finampclb $pcom/pclb.$ssnum.$job sndpcl=0 echo $sndpcl >$DATA/sndpcl $USHutil/$member $pcom/pclb.$ssnum.$job "$ifid" "$ssnum" read sndpcl < $DATA/sndpcl if test $sndpcl -eq '0' then msgs="PCLFILE $ifid WAS SENT TO $lprntr VIA DBNET!" else msgs="ERROR $ifid WAS NOT SENT TO $lprntr!" fi postmsg "$jlogfile" "$msgs" let i=$i-1 done set +x fi # ------------------------------------------------------------- len=3200 skp=3200 parmcutc="lrecl=528,byskp=0,byshw="$widatl",lnskp="$skp",lnshw="$len",dotpi="$dots",swaby=0,hdrby=0,large=1,nogrd=1" export XLFRTEOPTS="unit_vars=yes" export XLFUNIT_75="$DATA/dispuras.$ssnum.msg.$pid" # the consol message file. startmsg $EXECutil/dispuras $finamras $finampcl \ pcarm=$parmcutc 2>> errfile err=$?;export err; err_chk set -x i=$numcp while [ "$i" -ge 1 ] do # copy the pcl file into pcom cp $finampclc $pcom/pclc.$ssnum.$job sndpcl=0 echo $sndpcl >$DATA/sndpcl $USHutil/$member $pcom/pclc.$ssnum.$job "$ifid" "$ssnum" read sndpcl < $DATA/sndpcl if test $sndpcl -eq '0' then msgs="PCLFILE $ifid WAS SENT TO $lprntr VIA DBNET!" else msgs="ERROR $ifid WAS NOT SENT TO $lprntr!" fi postmsg "$jlogfile" "$msgs" let i=$i-1 done set +x if ((ltwosideqq == 1)) then parmcutd="lrecl=528,byskp=250,byshw="$widpac",lnskp="$skp",lnshw="$len",dotpi="$dots",swaby=0,hdrby=0,large=1,nogrd=1" export XLFRTEOPTS="unit_vars=yes" export XLFUNIT_75="$DATA/dispuras.$ssnum.msg.$pid" # the consol message file. startmsg $EXECutil/dispuras $finamras $finampcld \ parm=$parmcutd 2>> errfile err=$?;export err; err_chk set -x i=$numcp while [ "$i" -ge 1 ] do # copy the pcl file into pcom cp $finampcld $pcom/pcld.$ssnum.$job sndpcl=0 echo $sndpcl >$DATA/sndpcl $USHutil/$member $pcom/pcld.$ssnum.$job "$ifid" "$ssnum" read sndpcl < $DATA/sndpcl if test $sndpcl -eq '0' then msgs="PCLFILE $ifid WAS SENT TO $lprntr VIA DBNET!" else msgs="ERROR $ifid WAS NOT SENT TO $lprntr!" fi postmsg "$jlogfile" "$msgs" let i=$i-1 done set +x fi # ------------------------------------------------------------- # ... for page3, in order to overlap with page2 if possible, ((hundreds = ((length + 99) / 100) * 100)) ((skp = hundreds - 3200)) ((len = length - skp)) parmcute="lrecl=528,byskp=0,byshw="$widatl",lnskp="$skp",lnshw="$len",dotpi="$dots",swaby=0,hdrby=0,large=1,nogrd=1" export XLFRTEOPTS="unit_vars=yes" export XLFUNIT_75="$DATA/dispuras.$ssnum.msg.$pid" # the consol message file. startmsg $EXECutil/dispuras $finamras $finampcle \ parm=$parmcute 2>> errfile err=$?;export err; err_chk set -x i=$numcp while [ "$i" -ge 1 ] do # copy the pcl file into pcom cp $finampcle $pcom/pcle.$ssnum.$job sndpcl=0 echo $sndpcl >$DATA/sndpcl $USHutil/$member $pcom/pcle.$ssnum.$job "$ifid" "$ssnum" read sndpcl < $DATA/sndpcl if test $sndpcl -eq '0' then msgs="PCLFILE $ifid WAS SENT TO $lprntr VIA DBNET!" else msgs="ERROR $ifid WAS NOT SENT TO $lprntr!" fi postmsg "$jlogfile" "$msgs" let i=$i-1 done set +x if ((ltwosideqq == 1)) then parmcutf="lrecl=528,byskp=250,byshw="$widpac",lnskp="$skp",lnshw="$len",dotpi="$dots",swaby=0,hdrby=0,large=1,nogrd=1" export XLFRTEOPTS="unit_vars=yes" export XLFUNIT_75="$DATA/dispuras.$ssnum.msg.$pid" # the consol message file. startmsg $EXECutil/dispuras $finamras $finampclf \ parm=$parmcutf 2>> errfile err=$?;export err; err_chk set -x i=$numcp while [ "$i" -ge 1 ] do # copy the pcl file into pcom cp $finampclf $pcom/pclf.$ssnum.$job sndpcl=0 echo $sndpcl >$DATA/sndpcl $USHutil/$member $pcom/pclf.$ssnum.$job "$ifid" "$ssnum" read sndpcl < $DATA/sndpcl if test $sndpcl -eq '0' then msgs="PCLFILE $ifid WAS SENT TO $lprntr VIA DBNET!" else msgs="ERROR $ifid WAS NOT SENT TO $lprntr!" fi postmsg "$jlogfile" "$msgs" let i=$i-1 done set +x fi # ------------------------------------------------------------- fi fi rm ras.$ssnum.$pid rm crd.$ssnum.$pid set +x