Tuesday, March 04, 2008

Informatica PowerCenter 7.x ETL UNIX Shell scripts

Informatica PowerCenter 7.x ETL UNIX Shell scriptsProgram: etl_unix_shell_script.sh

Purpose: Sample UNIX shell script to load environment variables

needed to run PowerMart jobs, pass username and password variables

and start the job using the pmcmd command line.

$1 = Project Id Parameter (ie. ud, hr, dss, siq, etc.)

Example usage: etl_unix_shell_script.sh dss

NOTE: Enter the Project ID parameter that is designated in the
directory structure for your team
(ie. dss would be used for the DWDAS team as the
directory is /usr/local/autopca/dss/)
Call the script to set up the Informatica Environment Variables:

/usr/local/bin/set_pm_var.sh

Read ETL configuration parameters from a separate file:
ETL_CONFIG_FILE=$JOBBASE/$1/remote_accts/test_etl.config
ETL_USER=`grep ETL_USER $ETL_CONFIG_FILE | awk -F: '{print $2}'`
ETL_PWD=`grep ETL_PWD $ETL_CONFIG_FILE | awk -F: '{print $2}'`
Start the job
$PM_HOME/pmcmd startworkflow -u $ETL_USER -p $ETL_PWD -s $MACHINE:4001 -f DWDAS_
LOAD_dssqa wait s_m_CENTER_INSTITUTE
Trap the return code
rc=$?
if [[ $rc -ne 0 ]] then
exit $rc
Program: set_pm_var.sh

Purpose: UNIX script which sets the variables for running PowerMart 6.2
when called from a shell script (ie. script run by Autosys).


Set up the Informatica Variables
export MACHINE=`hostname`

export SHLIB_PATH=/usr/local/pmserver/informatica/pm/infoserver

export PM_HOME=/usr/local/pmserver/informatica/pm/infoserver
Set the environment variables needed for scheduling jobs.

The value of JOBBASE differs based on the account. For AUTOSYS

and AUTODBA, the variable should evaluate to /usr/local/autopca.

For all other accounts, it should evaluate to their $HOME variable.
case $HOME in
/home/autopca/autopca) JOBBASE=/usr/local/autopca ;;

/home/autopca/autodba) JOBBASE=/usr/local/autopca ;;

*) JOBBASE=$HOME ;;

esac
export JOBBASE

No comments: