Page 1 of 1
Pass Current Job name to Shell Script
Posted: Mon Apr 01, 2013 6:18 am
by mac4rfree85
Hi Guys,
I am calling a shell script using the After-Job subroutine from the job properties. I need to pass the current job name for this script as a Parameter.
The shell script is able to take the parameter if i run it individually.
This is the code i tried.
Code: Select all
sh -x test.sh -f DSGetJobInfo(DSJ.ME, DSJ.JOBNAME)
Can somebody help me out.
Cheers!!!!
Posted: Mon Apr 01, 2013 7:14 am
by chulett
Perhaps equivalent but the officially documented InfoType is DSJ_JOBNAME with an underscore. There's also a macro you can use.
Posted: Wed Apr 03, 2013 12:35 am
by mac4rfree85
I am getting the below error
Code: Select all
SH: -c: line 0: syntax error near unexpected token `('
SH: -c: line 0: `sh -x /appl/data/VSTAR/na/scripts/test.sh -f DSGetJobInfo(DSJ.ME, DSJ_JOBNAME)'
Just to check if the script is working fine, i ran it with the actual jobname itself.
Code: Select all
Executed command: sh -x /appl/data/VSTAR/na/scripts/test.sh -f NA_D_Stg_Vid_AudTrl_TM_000
*** Output from command was: ***
+ getopts f: c
+ case $c in
+ File=NA_D_Stg_Vid_AudTrl_TM_000
+ getopts f: c
+ echo NA_D_Stg_Vid_AudTrl_TM_000
NA_D_Stg_Vid_AudTrl_TM_000
Could somebody please help me out with this.
Cheers!!!!
Posted: Wed Apr 03, 2013 2:58 am
by ray.wurlod
You can't use sh as an after-job subroutine. Use ExecSH instead. For the job name, try a reference to the DataStage macro #DSJobName#
Posted: Mon Apr 08, 2013 3:02 am
by mac4rfree85
Ray, i was using ExecSh option only. I modified the ExecSh routine to obtain the jobname and attach it to the command.
The issue is fixed now.
Posted: Mon Apr 08, 2013 7:18 am
by chulett
You modified the ExecSH routine? Not a good idea unless you gave this version a new name as well.