You are on page 1of 3

Standards for ETL UNIX Shell Scripts for use with PowerCenter 7.1.

3
Scriptin Standards !for PowerCenter "ersion 7.1.3#$
Scripting standards include the use of a UNIX shell script, which the scheduling tool uses to start the
PowerCenter job, and a separate file which contains the username and password for the user called in the
script. The following is a template that should be used to create scripts for new scheduled jobs. ollowing
is the script and e!planation. This script has been pro"ided as an e!ample and is named
etl_unix_shell_script.sh.
# Program: etl_unix_shell_script.sh
# Author: Kevin Gillenwater
# Date: 7/2/2!!"
# Purpose: #ample $%&' shell script to loa( environment varia)les
# nee(e( to run Power*art +o)s, pass username an( passwor( varia)les
# an( start the +o) using the pmcm( comman( line.
#
# -. / Pro+ect &( Parameter 0ie. u(, hr, (ss, si1, etc.2
#
# 3xample usage: etl_unix_shell_script.sh (ss
#
# %453: 3nter the Pro+ect &D parameter that is (esignate( in the
# (irector6 structure 7or 6our team
# 0ie. (ss woul( )e use( 7or the D8DA# team as the
# (irector6 is /usr/local/autopca/(ss/2

#99999999999999999999999999999999999999999999999999999999999999999
# :all the script to set up the &n7ormatica 3nvironment ;aria)les:
#99999999999999999999999999999999999999999999999999999999999999999

. /usr/local/)in/set_pm_var.sh

#99999999999999999999999999999999999999999999999999999999999999999
# <ea( 35= con7iguration parameters 7rom a separate 7ile:
#99999999999999999999999999999999999999999999999999999999999999999

35=_:4%>&G_>&=3/-?4@@A#3/-./remote_accts/test_etl.con7ig
35=_$#3</Agrep 35=_$#3< -35=_:4%>&G_>&=3 B awC 9>: DEprint -2FDA
35=_P8D/Agrep 35=_P8D -35=_:4%>&G_>&=3 B awC 9>: DEprint -2FDA
#99999999999999999999999999999999999999999999999999999999999999999
# #tart the +o)
#99999999999999999999999999999999999999999999999999999999999999999

-P*_G4*3/pmcm( startworC7low 9u -35=_$#3< 9p -35=_P8D 9s -*A:G&%3:!!. 97 D8DA#_
=4AD_(ss1a Hwait s_m_:3%53<_&%#5&5$53
#99999999999999999999999999999999999999999999999999999999999999999
# 5rap the return co(e
#99999999999999999999999999999999999999999999999999999999999999999

rc/-I
i7 JJ -rc 9ne ! KK then
exit -rc
7i
Notes %eardin the Script&Standards$
.. The beginning of each script should call and e!ecute the script set_pm_var.sh to set up the
PowerCenter "ariables used in the session #. $usr$local$bin$set%pm%"ar.sh&. The set_pm_var.sh, located on
each machine #'eisure for Production and (lance for )e"elopment&, will pro"ide ease of maintenance if
changes need to be made to PowerCenter "ariables, and will pro"ide one source for the scripts on a
machine. The following is the code in the script. *ou will not need to do an+thing with this script, it is for
informational purposes onl+,
# Program: set_pm_var.sh
# Author: Kevin Gillenwater
# Date: 7/"/2!!"
# Purpose: $%&' script which sets the varia)les 7or running Power*art L.2
# when calle( 7rom a shell script 0ie. script run )6 Autos6s2.

#9999999999999999999999999999999999999999999
##et up the &n7ormatica ;aria)les
#9999999999999999999999999999999999999999999

export *A:G&%3/AhostnameA
export #G=&@_PA5G//usr/local/pmserver/in7ormatica/pm/in7oserver
export P*_G4*3//usr/local/pmserver/in7ormatica/pm/in7oserver

#999999999999999999999999999999999999999999999999999999999999999999999
# #et the environment varia)les nee(e( 7or sche(uling +o)s.
# 5he value o7 ?4@@A#3 (i77ers )ase( on the account. >or A$54#M#
# an( A$54D@A, the varia)le shoul( evaluate to /usr/local/autopca.
# >or all other accounts, it shoul( evaluate to their -G4*3 varia)le.
#999999999999999999999999999999999999999999999999999999999999999999999

case -G4*3 in

/home/autopca/autopca2 ?4@@A#3//usr/local/autopca NN
/home/autopca/auto()a2 ?4@@A#3//usr/local/autopca NN
O2 ?4@@A#3/-G4*3 NN

esac

export ?4@@A#3
2. The second section of etl_unix_shell_script.sh sets up -T' parameters for username and password
usage b+ PowerCenter when running the wor.flow. The username and password are no longer stored as
part of the main shell script. In the script e!ample, the filename test_etl_config contains the username and
password to be used when running the wor.flow. ollowing is the contents of test_etl_config,
35=_$#3<:etlgu6
35=_P8D:ouP.2
This file #+our password file& must be located in +our team director+ under the remote_accts folder #i.e.
$usr$local$autopca$dss$remote%accts$&. The folder permissions on the Production machine will onl+ permit
PC/0s access to this folder. The permissions should be 12324 #rw,r,2& on this file.
". The third section of etl_unix_shell_script.sh contains the command to run the wor.flow in
PowerCenter. Please follow the script e!actl+. The onl+ thing that will need to be changed in this section
is the folder name and the wor.flow within the folder that is being e!ecuted
#i.e. ... D8DA#_=4AD_(ss1a w7lw_m_:3%53<_&%#5&5$53&.
. The final section of etl_unix_shell_script.sh contains code to trap the return code of the script that
indicated success or failure..
56$78$49 : /dded ;2wait0 parameter to the pmcmd command line to start the scheduled job.
5<4$1$43 2 Updated to generali=e the scheduling tool used to run the shell scripts as UC3 has been chosen
to replace /utos+s as the scheduling tool used to run Power>art wor.flows.

You might also like