Page 1 of 1

shell script

Posted: Wed Jun 22, 2005 2:33 pm
by studyguy2001
hello.,

i am working on parallel extender v7.5.
i never write a shell script to run the datastage jobs.
i normally used datastage director to run the jobs.

i am new to shell scripting. can anyone please help me
with a sample shell script to run the datastage job.
in the shell script i also have to get the job status and
check whether the job is success or failure.

can anyone please help me.,

thanks
kevin

Posted: Wed Jun 22, 2005 2:48 pm
by chulett
There's one here.

shell script

Posted: Wed Jun 22, 2005 2:56 pm
by studyguy2001
chulett wrote:There's one here.
Hello craig.,

if you have a sample shell script then can you please please provide me.
it will be a great help to me.

thanks
kevin

Re: shell script

Posted: Wed Jun 22, 2005 3:47 pm
by studyguy2001
hello.,

i am working on parallel extender v7.5.
i never write a shell script to run the datastage jobs.
i normally used datastage director to run the jobs.

i am new to shell scripting. can anyone please help me
with a sample shell script to run the datastage job.
in the shell script i also have to get the job status and
check whether the job is success or failure.

can anyone please help me.,

thanks
kevin

Posted: Wed Jun 22, 2005 5:27 pm
by ray.wurlod
The script to which Craig provided a link will run parallel or server jobs. No change is required, unless you want to control the value of the APT_CONFIG_FILE environment variable within the shell script. The dsjob command line interface is uninterested in the job type; it can start server jobs, parallel jobs or job sequences.

Posted: Wed Jun 22, 2005 7:45 pm
by chulett
I was going to say - that is the sample. You did click on the link, did you not?

Shell Script

Posted: Wed Jun 22, 2005 11:15 pm
by nandu_infy
Hi,

Here's some sample code...

If you want to run a dsjob from shell script...

${DSHOME}/bin/dsjob -run -param '$APT_CONFIG_FILE='$APT_CONFIG_FILE -param "STAGE_DIR=$STAGE_DIR" -param "INPUT_DIR=$INPUT_DIR" -warn "${warn_cnt}" -jobstatus ${DS_PROJ} Jobname

#to find out the status returned...
jobStatus=$?

Please not that whtvr you have $_______ or ${_______} are variables defined. You can define it in the shell script above before running the job.

eg:
export APT_CONFIG_FILE='/ascential/apt/Ascential/DataStage/Configurations/cfg4x4.apt'
export APT_BUFFER_MAXIMUM_TIMEOUT=1
export warn_cnt="nolimits"
export DS_PROJ="DEV_PROJ" (your ds project name)
export STAGE_DIR=${PROJ_DIR}/Data/staged etc...

Finding job status...

If you immediately follow jobStatus=$?
statement to the one running the job the status 1,2,3 or anything will be returned.

1- sucess without warnings
2- with warnings
3-aborted etc...

You might want to act further depending on the status, say reset the job if it aborts etc... The following function will take care of it...

Call the function ---check_status "Jobname" "$jobStatus"


check_status()
{
jobName=$1
jobStatus=$2

echo ""
if [[ $jobStatus -eq 1 ]] || [[ $jobStatus -eq 2 ]] || [[ $jobStatus -eq 141 ]]
then
echo "Job $jobName is successful with exit code $jobStatus"
else
echo "Job $jobName failed with exit code $jobStatus, script will reset the job and exit"
echo "Resetting the job..."
${DSHOME}/bin/dsjob -run -mode RESET ${DS_PROJ} ${jobName}
exit
fi
}

Re: Shell Script

Posted: Thu Jun 23, 2005 5:38 pm
by studyguy2001
Hello Everyone.,

Craig i went to the link and i saw the script.
i am now able t run my DS job using shell script you provided.

thanks a lot guys
bye
kevin