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

Scripting Standards (for PowerCenter version 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. Following is the script and explanation. This script has been provided as an example and is named
# # # # # # # # # # # # # # # Program: Author: Date: Purpose: Kevin Gillenwater 7/24/2003 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: 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/ #----------------------------------------------------------------# 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 fi

Notes Regarding the Script/Standards:

The only thing that will need to be changed in this section is the folder name and the workflow within the folder that is being executed (i. Please follow the script exactly.. The set_pm_var. the variable should evaluate to /usr/local/autopca.e.1. DWDAS_LOAD_dssqa wflw_m_CENTER_INSTITUTE). In the script example. # The value of JOBBASE differs based on the account. and will provide one source for the scripts on a machine. . it is for informational purposes only: # # # # # Program: set_pm_var.-) on this file. The following is the code in the The second section of etl_unix_shell_script.e. The username and password are no longer stored as part of the main shell script. The folder permissions on the Production machine will only permit PCA’s access to this folder. #--------------------------------------------------------------------case $HOME in /home/autopca/autopca) /home/autopca/autodba) *) esac export JOBBASE JOBBASE=/usr/local/autopca JOBBASE=/usr/local/autopca JOBBASE=$HOME . The beginning of each script should call and execute the script set_pm_var. /usr/local/autopca/dss/remote_accts/). located on each machine (Leisure for Production and Glance for Development) Author: Kevin Gillenwater Date: 7/3/2003 Purpose: UNIX script which sets the variables for running PowerMart 6. /usr/local/bin/set_pm_var.. # For all other accounts. The third section of etl_unix_shell_script.2 when called from a shell script (ie.r. . script run by Autosys). You will not need to do anything with this sets up ETL parameters for username and password usage by PowerCenter when running the workflow. it should evaluate to their $HOME to set up the PowerCenter variables used in the session (. 3. For AUTOSYS # and AUTODBA. The permissions should be 6-4-0 (rw. the filename test_etl_config contains the username and password to be used when running the will provide ease of maintenance if changes need to be made to PowerCenter variables.. 2. #------------------------------------------#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.. Following is the contents of test_etl_config: ETL_USER:etlguy ETL_PWD:ou812 This file (your password file) must be located in your team directory under the remote_accts folder ( contains the command to run the workflow in PowerCenter. . .

4. *8/27/03 – Added ‘-wait’ parameter to the pmcmd command line to start the scheduled job. . *10/6/04 .Updated to generalize the scheduling tool used to run the shell scripts as UC4 has been chosen to replace Autosys as the scheduling tool used to run PowerMart contains code to trap the return code of the script that indicated success or failure. The final section of etl_unix_shell_script.

Sign up to vote on this title
UsefulNot useful