We have moved to www.dataGenX.net, Keep Learning with us.

Friday, February 28, 2014

Check whether DataStage Job is Multi-Instance or not with Sctipt


The following script can be used to check if the given datastage job is multi instance or not.

Arguments to the Scripts:

Arg1:Datastage Project Name
Arg2:JobName



===========================================================================
#!/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 <<EOF > $tmpFile
LOGTO $Project
SELECT 'JobType:'||EVAL "TRANS('DS_JOBOBJECTS','J\':@RECORD<5>:'\ROOT',59,'X')" FROM DS_JOBS WHERE NAME = '$JobName';
EOF
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 :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
===========================================================================


Please let me know if any Issue with the script.