#! /usr/bin/ksh
#
# Function compJobNum: run pdls on a job and get the state 	
# returned and compare the state with the 2nd parameter.
# If they are equal, return 0 (success) else return 1.
# in this function the parameters are as follows:
#
# Input positional parameters:
#     $1. the job number
#     $2. state of the job that is expected (i.e. pending )
#
# This function returns 0 if success, else an error
#
# run the pdls command and get its answer
LOC_ANS=`$PD_PATH/pdls -r current-job-state $1 | tail -1 | awk '{ print $4 }'`

# check the return of the pdls
if [ $? != 0 ]
then
	reportError "compJobNum: pdls failure"
fi

# test to see if pdls returned what we expected - return 0 if yes
if [ "${LOC_ANS}" = "${2}" ]
then
   exit 0
fi

# error - didn't get back what we wanted
reportError compJobNum: - value got '-->'"${LOC_ANS}"'<--' wanted "${2}"
exit 1
#
#    Version      Date     Time    Owner   Comment
# ------------- -------- -------- -------- ----------------------------
# V1.2          01/26/95 15:57:22 kok      update current-job-state
