PeopleSoft Unix Process Scheduler running DataStage jobs.

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
Athorne
Participant
Posts: 57
Joined: Wed Feb 04, 2004 1:37 pm

PeopleSoft Unix Process Scheduler running DataStage jobs.

Post 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
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Sure, check out mine:

viewtopic.php?t=85578
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Athorne
Participant
Posts: 57
Joined: Wed Feb 04, 2004 1:37 pm

Post 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
Andrew Thorne

Lead Software Engineer
PeopleSoft Technical Architecture
Enterprise Rent-A-Car
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post 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.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Post Reply