Pass Current Job name to Shell Script

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
mac4rfree85
Participant
Posts: 126
Joined: Thu Jul 01, 2010 11:39 pm

Pass Current Job name to Shell Script

Post 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)

Code: Select all

sh -x test.sh -f DSJ.ME
Can somebody help me out.

Cheers!!!!
Mac4rfree
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Perhaps equivalent but the officially documented InfoType is DSJ_JOBNAME with an underscore. There's also a macro you can use.
-craig

"You can never have too many knives" -- Logan Nine Fingers
mac4rfree85
Participant
Posts: 126
Joined: Thu Jul 01, 2010 11:39 pm

Post 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!!!!
Mac4rfree
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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#
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
mac4rfree85
Participant
Posts: 126
Joined: Thu Jul 01, 2010 11:39 pm

Post 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.
Mac4rfree
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You modified the ExecSH routine? Not a good idea unless you gave this version a new name as well.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply