Hi All,
Does anyone have an example of a UNIX script for calling DataStage jobs that they would be willing to share and if so would they post it to the group? We want to be able to call DataStage from Control-M running.
UNIX script for calling datastage jobs
Phil,
I have attached a very simple example. Normally in production, a little more care would be taken with hardcoded password values, etc. This is just a guideline. Make sure that your parameters match the numbers and names of the parameters of your job when using "dsjob".
#!/usr/bin/ksh
## Purpose: sample ksh script
##
## variables
ENV=/server/data/dw
USERID=user
DSENV=/server/sys/Ardent/bin
DSSERVER=abcd
DSUSER=dsusername
DSPASSWORD=dspasswd
DSJOBNAME=dssamplejob
MKTRHOME=$ENV/marketer
INDIR=$ENV/source
MAINFILE=workfile.dat
OUTDIR=$ENV/work
DBWHMKIN=oraschema
DBWHMKOUT=oraschema
WORKDIR=$ENV/work
HASHDIR=$ENV/hash
REJECTS=$ENV/rejects
ORACLE_HOME=/prod/sys/oracle/ver815; export ORACLE_HOME LD_LIBRARY_PATH=$ORACLE_HOME/lib
## add timestamp to log
TIMESTAMP=`date`
echo " script start on ..... $TIMESTAMP"
## cp the file from FTP directory to working source file
## remove the FTPd file
cd $INDIR
rm $MAINFILE
cd $INDIR/ftpdir
cp * $INDIR/$MAINFILE
rm *
## the following run datastage job mcMkPrstyRtCput
## check status using datastage director
echo "running datastage job dssamplejob"
$DSENV/dsjob -server $DSSERVER -user $DSUSER -password $DSPASSWORD -run -warn 50 -param dbwhmkin=$DBWHMKIN -param dbwhmkout=$DBWHMKOUT -param userid=$USERID -param password=passwd -param hash=$HASHDIR -param rejects =$REJECTS -param indir=$INDIR -param mainfile=$MAINFILE -param jobname =$DSJOBNAME -param outdir=$OUTDIR -jobstatus dsproj $DSJOBNAME
RETURN_CODE=`$DSENV/dsjob -server $DSSERVER -user $DSUSER -password $DSPASSWORD -jobinfo dsproj $DSJOBNAME | grep -i FAILED`
if [ $RETURN_CODE "" ]; then
echo " script failed with return code = $RETURN_CODE"
exit 1
else
echo " script finished normally. "
exit 0
fi
Hope this helps.
"Phil Walker"
cc:
Subject: UNIX script for calling datastage jobs
08/09/01
04:15 PM
Please
respond to
datastage-use
rs
Hi All,
Does anyone have an example of a UNIX script for calling DataStage jobs that they would be willing to share and if so would they post it to the group? We want to be able to call DataStage from Control-M running.
I have attached a very simple example. Normally in production, a little more care would be taken with hardcoded password values, etc. This is just a guideline. Make sure that your parameters match the numbers and names of the parameters of your job when using "dsjob".
#!/usr/bin/ksh
## Purpose: sample ksh script
##
## variables
ENV=/server/data/dw
USERID=user
DSENV=/server/sys/Ardent/bin
DSSERVER=abcd
DSUSER=dsusername
DSPASSWORD=dspasswd
DSJOBNAME=dssamplejob
MKTRHOME=$ENV/marketer
INDIR=$ENV/source
MAINFILE=workfile.dat
OUTDIR=$ENV/work
DBWHMKIN=oraschema
DBWHMKOUT=oraschema
WORKDIR=$ENV/work
HASHDIR=$ENV/hash
REJECTS=$ENV/rejects
ORACLE_HOME=/prod/sys/oracle/ver815; export ORACLE_HOME LD_LIBRARY_PATH=$ORACLE_HOME/lib
## add timestamp to log
TIMESTAMP=`date`
echo " script start on ..... $TIMESTAMP"
## cp the file from FTP directory to working source file
## remove the FTPd file
cd $INDIR
rm $MAINFILE
cd $INDIR/ftpdir
cp * $INDIR/$MAINFILE
rm *
## the following run datastage job mcMkPrstyRtCput
## check status using datastage director
echo "running datastage job dssamplejob"
$DSENV/dsjob -server $DSSERVER -user $DSUSER -password $DSPASSWORD -run -warn 50 -param dbwhmkin=$DBWHMKIN -param dbwhmkout=$DBWHMKOUT -param userid=$USERID -param password=passwd -param hash=$HASHDIR -param rejects =$REJECTS -param indir=$INDIR -param mainfile=$MAINFILE -param jobname =$DSJOBNAME -param outdir=$OUTDIR -jobstatus dsproj $DSJOBNAME
RETURN_CODE=`$DSENV/dsjob -server $DSSERVER -user $DSUSER -password $DSPASSWORD -jobinfo dsproj $DSJOBNAME | grep -i FAILED`
if [ $RETURN_CODE "" ]; then
echo " script failed with return code = $RETURN_CODE"
exit 1
else
echo " script finished normally. "
exit 0
fi
Hope this helps.
"Phil Walker"
cc:
Subject: UNIX script for calling datastage jobs
08/09/01
04:15 PM
Please
respond to
datastage-use
rs
Hi All,
Does anyone have an example of a UNIX script for calling DataStage jobs that they would be willing to share and if so would they post it to the group? We want to be able to call DataStage from Control-M running.
we have same kind of setup we are also using control-m.
we use dsjob to run datastage one main job from unix ( jobcontrol job ) rest of the jobs are called from indside the jobcontrol job dsjob syntax is very simple.
thanks and regards
Sudhir Mahendru
CTI-Banking Systems- IDMS/IDMS-DataWarehouse
(65) 423-7449
---------------------------------------- Message History ----------------------------------------
From: philw@gnosys.co.nz on 10/08/2001 08:15 ZE12
Please respond to datastage-users@oliver.com
To: datastage-users@oliver.com
cc:
Subject: UNIX script for calling datastage jobs
Hi All,
Does anyone have an example of a UNIX script for calling DataStage jobs that they would be willing to share and if so would they post it to the group? We want to be able to call DataStage from Control-M running.
--
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
we use dsjob to run datastage one main job from unix ( jobcontrol job ) rest of the jobs are called from indside the jobcontrol job dsjob syntax is very simple.
thanks and regards
Sudhir Mahendru
CTI-Banking Systems- IDMS/IDMS-DataWarehouse
(65) 423-7449
---------------------------------------- Message History ----------------------------------------
From: philw@gnosys.co.nz on 10/08/2001 08:15 ZE12
Please respond to datastage-users@oliver.com
To: datastage-users@oliver.com
cc:
Subject: UNIX script for calling datastage jobs
Hi All,
Does anyone have an example of a UNIX script for calling DataStage jobs that they would be willing to share and if so would they post it to the group? We want to be able to call DataStage from Control-M running.
--
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
This is really pleasing news from Sudhir. Its what Ive been pushing for some time.
For full syntax of dsjob see the Server Job Developers Guide.
If you type dsjob alone at the command prompt you get the "top level" syntax returned as part of the error message. Similarly if you enter a partial dsjob command (example: dsjob -run Projectname), you get the expected syntax for this major command option. There is also at least one undocumented option (at 4.0 anyway), -jobstatus.
-----Original Message-----
From: Sudhir Mahendru [mailto:sudhir.mahendru@db.com]
Sent: Friday, 10 August 2001 11:14
To: datastage-users@oliver.com
Subject: Re: UNIX script for calling datastage jobs
we have same kind of setup we are also using control-m.
we use dsjob to run datastage one main job from unix ( jobcontrol job ) rest of the jobs are called from indside the jobcontrol job dsjob syntax is very simple.
thanks and regards
Sudhir Mahendru
CTI-Banking Systems- IDMS/IDMS-DataWarehouse
(65) 423-7449
---------------------------------------- Message
History ----------------------------------------
From: philw@gnosys.co.nz on 10/08/2001 08:15 ZE12
Please respond to datastage-users@oliver.com
To: datastage-users@oliver.com
cc:
Subject: UNIX script for calling datastage jobs
Hi All,
Does anyone have an example of a UNIX script for calling DataStage jobs that they would be willing to share and if so would they post it to the group? We want to be able to call DataStage from Control-M running.
--
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
For full syntax of dsjob see the Server Job Developers Guide.
If you type dsjob alone at the command prompt you get the "top level" syntax returned as part of the error message. Similarly if you enter a partial dsjob command (example: dsjob -run Projectname), you get the expected syntax for this major command option. There is also at least one undocumented option (at 4.0 anyway), -jobstatus.
-----Original Message-----
From: Sudhir Mahendru [mailto:sudhir.mahendru@db.com]
Sent: Friday, 10 August 2001 11:14
To: datastage-users@oliver.com
Subject: Re: UNIX script for calling datastage jobs
we have same kind of setup we are also using control-m.
we use dsjob to run datastage one main job from unix ( jobcontrol job ) rest of the jobs are called from indside the jobcontrol job dsjob syntax is very simple.
thanks and regards
Sudhir Mahendru
CTI-Banking Systems- IDMS/IDMS-DataWarehouse
(65) 423-7449
---------------------------------------- Message
History ----------------------------------------
From: philw@gnosys.co.nz on 10/08/2001 08:15 ZE12
Please respond to datastage-users@oliver.com
To: datastage-users@oliver.com
cc:
Subject: UNIX script for calling datastage jobs
Hi All,
Does anyone have an example of a UNIX script for calling DataStage jobs that they would be willing to share and if so would they post it to the group? We want to be able to call DataStage from Control-M running.
--
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.