How To Find a DataStage Job is Multi Instance or not for Reporting

Here are steps which can be used in a script to check if the given datastage job is multi instance or not.
What is needed to retrieve this is Datastage Project Name and Job Name

#!/bin/ksh
ScriptName=$(\basename $0)
if [[ $# != 2 ]];then
printf “Error: $ScriptName – Required parameter(s) was not supplied!\n\n”
printf “Usage: $ScriptName  <Project> <JobName>\n\n”
printf “       <Project> : is the unique identifier for the datastage project, required\n”
printf “       <JobName> : is the Datastage JobName, required\n”
exit 1
fi

Project=$1
JobName=$2

echo “step ………: checking job whether it is multiinstance or not”

DSHOME=`cat /.dshome`
tmpFile=/tmp/CheckJobType.tmp
cd $DSHOME
bin/uvsh <<! > $tmpFile
LOGTO $Project
SELECT  ‘JobType:’||EVAL “TRANS(‘DS_JOBOBJECTS’,'J\’:@RECORD<5>:’\ROOT’,59,’X')”  FROM DS_JOBS WHERE NAME = ‘$JobName’;
!
if [[ $? != 0 ]]; then
echo “CheckJobType – unable to determine jobtype for job $JobNameh in $Project datastage project!”
exit 1
fi
JobType=$(\grep “^JobType:” $tmpFile |\cut -f 2 -d
if [[ -z $JobType ]]; then
echo “CheckJobType – Job $JobName not found in $Project datastage project. JobType cannot be determined!”
\rm -f $tmpFile
exit 1
fi
if [[ $JobType -eq 0 ]]; then
echo “*****$JobName is not a multi instance job*****”
else
echo “*****$JobName is  multi instance job*****”
fi
\rm -f $tmpFile
exit 0

-Ritesh
Disclaimer: The postings on this site are my own and don't necessarily represent IBM's positions, strategies or opinions