Page 1 of 1

PeopleSoft Unix Process Scheduler running DataStage jobs.

Posted: Fri Oct 08, 2004 9:02 am
by Athorne
For those interested, I put together a Unix version of the PeopleSoft delivered Windows Bat file to run ETLs using the Process Scheduler. I'm curious is anyone else has something like this, and if so please send me a copy or post it here in the forum. I'm not the best scripter in the world so I'm sure others have a better way of doing this.

You will need to create two .sh files and put them into the $PS_HOME/appserv/prcs/<Scheduler> folder with execute rights by your Unix Process ID. Make sure you lock down the dsparam.sh so users can't see the password for your dsadmin ID. Here is an example of what I have for both files.

dsparam.sh

Code: Select all

export DS_SERVER=<server hostname here>
export DS_USER=<dsadmin unix id here>
export DS_PASSWORD=<dsadmin unix id password here>
export DS_PROJECT=<project name for this scheduler here, example FDM84_88_PWSBX8>
export DS_HOME=<dshome here, example /opt/Ascential/DataStage/DSEngine>
dscmd.sh Note: PeopleSoft delivered instructions have dscmd.bat, make sure to change your process type command line to be dscmd.sh instead of CMD /c dscmd.bat I apologize for the code snipet below, it's hard to work in this small window and show that some commands are all one line. Just make sure that anywhere there is a then or else statement, the code following it is all on one line.

Code: Select all

#!/usr/bin/sh
. ./dsparam.sh

case $2 in
  [0])     VAR1="Batch::RunFolder"
           VAR2=`echo $1|awk -F "-" '{print $2}'`
           VAR3=`echo $1|awk -F "-" '{print $3}'`
              if [ $VAR2 == "Destructive_OR_Incremental" ]
              then $DS_HOME/bin/dsjob -server $DS_SERVER -user $DS_USER -password $DS_PASSWORD -run -param FolderName=$VAR2 -param LoadType=$VAR3 $DS_PROJECT $VAR1
              if [ $? <> 0 ]
              then exit 1
              fi
              else $DS_HOME/bin/dsjob -server $DS_SERVER -user $DS_USER -password $DS_PASSWORD -run -param FolderName=$VAR2 $DS_PROJECT $VAR1
              if [ $? <> 0 ]
              then exit 1
              fi
              fi;;
  [1])     SVAR1=`echo $1|awk -F "-" '{print $1}'`
           SVAR2=`echo $1|awk -F "-" '{print $2}'`
              if [ $SVAR2 == "I" ]
              then $DS_HOME/bin/dsjob -server $DS_SERVER -user $DS_USER -password $DS_PASSWORD -run -param '$
LoadType='$SVAR2 $DS_PROJECT $SVAR1
              if [ $? <> 0 ]
              then exit 1
              fi
              else $DS_HOME/bin/dsjob -server $DS_SERVER -user $DS_USER -password $DS_PASSWORD -run $DS_PROJECT $SVAR1
              if [ $? <> 0 ]
              then exit 1
              fi
              fi;;
  *)     ;;
esac
echo "Execution Complete"
exit 0
Andy

Posted: Fri Oct 08, 2004 9:12 am
by kcbland
Sure, check out mine:

viewtopic.php?t=85578

Posted: Fri Oct 08, 2004 9:18 am
by Athorne
:shock: So that is what people can do when they have a combination of time, scripting skills, and a vested interest and making things work correctly. :P

Awesome code there Ken, and so clean too... If you didn't get many gold stars when you were in school, consider this a 5 star. :lol:

Andy

Posted: Fri Oct 08, 2004 9:40 am
by kcbland
:oops: Awe schucks, thanks for the gold stars.

Actually, credit where credit is due. Steve Boyce handles all of the infrastructure and his talents include developing the underlying framework of scripts and process on which our ETL framework rests. You see a sampling of the skill he brings to our team.