Pages

Tuesday, February 14, 2012

Bash command with parameters to run PDI transformation

fatigue_export.sh file
#!/bin/bash
echo "Enter the name of the sample file(eg CVAR_Good_20110104):"
read sample_file #sample_file is the variable which pick the entered value
echo "Enter the wave (eg 1):" read wave_no   #wave_no is the variable 
/home/kettle4/pan.sh -file=/home/pdi_transforms/ibmcvar/fatigue/pdi_transforms/fatigue_export.ktr -norep -param:FILENAME=$sample_file -param:WAVE=$wave_no -XX:-UseGCOverheadLimit
PDI Transformation properties (Ctrl + T)
Define the parameters name in transformation properties and keep the default values empty














windows batch file with few validations
@ECHO OFF
ECHO  Enter your job number %1
SET /P userin=

IF "%userin%"=="" (
 ECHO ----------------------------------
 echo "You should enter a job number..."
 ECHO ----------------------------------
 pause
 exit
)
IF NOT EXIST Q:\secure\%userin% (
 ECHO %userin% Job directory doesn't exist in Q:\secure\
 ECHO -----------------------------
 ECHO Please enter valid job number
 ECHO -----------------------------
 pause
 exit
)
IF EXIST Q:\secure\%userin% (
 ECHO ------------------------------------------------- 
 ECHO Maximum sample numbers are being calculated......
 ECHO This may take few minutes. please wait...........
 L:\kettle4.2\Kitchen.bat /file="W:\Panelsample_iss\max_sample_no\max_sample_no.kjb" "-param:jobno=%userin%" > nul
 ECHO -------------------------------------------------  
 ECHO -------------------------------------------------
 ECHO Please check max_sample_nos_%userin% file inside 
 IF EXIST w:\%userin%\Sample\ToLoad (
  echo w:\%userin%\Sample\ToLoad
  pause
 ) else ( 
  echo w:\%userin%US\Sample\ToLoad directory
  pause
 )
)