#!/bin/sh
########################################################################
#                 copyright 2001, Amoco Production Company             #
#                             All Rights Reserved                      #
#                     an affiliate of BP America Inc.                  #
########################################################################
 # shell script
# this shell procedure should string a job file using
# Rob Read's streamjob (was filter) program and start it up
#
# usage:
# startjob job-filename executable-filename(optional) 
#
# 2/18/93 - set ACCTID on non-Cray machines - j.m.wade
#
 if test $# -eq 0
 then echo "you must give the name of a job file" >&2
     exit 1
 fi
#
 if test "$1" = "?" 
 then echo "usage: startjob job-filename executable-filename(optional)"
    exit 1
 fi
#
  if test ! -s $1
 then echo $1 "does not exist"
       exit 1
 fi
#
# set ACCTID to 6-digit pid number
#
SJID=$$
ACCTID=`echo $SJID | sed 's/^./000000&/' | \
	sed  's/.\{6\}$/ &/' |  awk  '{print $2}'`
export ACCTID
#
 if test $# -eq 2 
 then streamjob < $1 > $2
     chmod +x $2
     $2
 else 
    streamjob < $1 | sh
 fi
#
