UNIX shell script standards for PowerCenter 713 | Directory (Computing) | Scripting Language

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

3
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 etl_unix_shell_script.sh.
# # # # # # # # # # # # # # # Program: Author: Date: Purpose: etl_unix_shell_script.sh 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: 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 fi

Notes Regarding the Script/Standards:

1.The beginning of each script should call and execute the script set_pm_var.sh to set up the PowerCenter variables used in the session (. /usr/local/bin/set_pm_var.sh). The set_pm_var.sh, located on each machine (Leisure for Production and Glance for Development), will provide ease of maintenance if changes need to be made to PowerCenter variables, and will provide one source for the scripts on a machine. The following is the code in the script. You will not need to do anything with this script, it is for informational purposes only:
# # # # # Program: set_pm_var.sh Author: Kevin Gillenwater Date: 7/3/2003 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) /home/autopca/autodba) *) esac export JOBBASE JOBBASE=/usr/local/autopca JOBBASE=/usr/local/autopca JOBBASE=$HOME ;; ;; ;;

2.The second section of etl_unix_shell_script.sh sets up ETL parameters for username and password usage by PowerCenter when running the workflow. The username and password are no longer stored as part of the main shell script. In the script example, the filename test_etl_config contains the username and password to be used when running the workflow. 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 (i.e. /usr/local/autopca/dss/remote_accts/). The folder permissions on the Production machine will only permit PCA’s access to this folder. The permissions should be 6-4-0 (rw,r,-) on this file. 3.The third section of etl_unix_shell_script.sh contains the command to run the workflow in PowerCenter. Please follow the script exactly. 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.e. ... DWDAS_LOAD_dssqa wflw_m_CENTER_INSTITUTE).

4.The final section of etl_unix_shell_script.sh contains code to trap the return code of the script that indicated success or failure..

*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 workflows.

Sign up to vote on this title
UsefulNot useful