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
shell script
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 19
- Joined: Tue Feb 01, 2005 11:46 pm
shell script
Hello craig.,chulett wrote:There's one here.
if you have a sample shell script then can you please please provide me.
it will be a great help to me.
thanks
kevin
-
- Participant
- Posts: 19
- Joined: Tue Feb 01, 2005 11:46 pm
Re: shell script
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
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
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 3
- Joined: Tue Feb 15, 2005 7:19 am
Shell Script
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
}
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
}
-
- Participant
- Posts: 19
- Joined: Tue Feb 01, 2005 11:46 pm
Re: Shell Script
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
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