Pass in parameter to ExecCommand stage
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 76
- Joined: Mon Mar 05, 2007 9:26 pm
- Location: Malaysia
Pass in parameter to ExecCommand stage
Hi All,
I am trying to pass in a parameter to execute command stage, and based on the passed-in value, the shell script could execute accordingly.
However, the pass-in value is not able to pass down to the shell script. As i performed echo from the shell script, the log shown that the value being passed in is null.
Need your help on how the shell script would 'catch' the parameter value.
In shell script, i perform a variable assignment
version = "$1" so that the pass-in value assign to "version".
Pardon me if this has been answered, could you hint on the search keywords or the url. Many thanks.
I am trying to pass in a parameter to execute command stage, and based on the passed-in value, the shell script could execute accordingly.
However, the pass-in value is not able to pass down to the shell script. As i performed echo from the shell script, the log shown that the value being passed in is null.
Need your help on how the shell script would 'catch' the parameter value.
In shell script, i perform a variable assignment
version = "$1" so that the pass-in value assign to "version".
Pardon me if this has been answered, could you hint on the search keywords or the url. Many thanks.
-
- Participant
- Posts: 110
- Joined: Mon Jan 11, 2010 4:22 am
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 76
- Joined: Mon Mar 05, 2007 9:26 pm
- Location: Malaysia
Thanks all for your response.
I tried execute the shell script(without being called by datastage) it works.
In the property of execute command stage,
command:
. /u01/dstage/hpbdev/Sequential/FI/Scripts/RemoveTrailer_FI_MOH_Budget.sh
Parameters:
#VER_ID#
Log says,
JobControl (@Execute_Command): Executed: . /u01/dstage/hpbdev/Sequential/FI/Scripts/RemoveTrailer_FI_MOH_Budget.sh I
Reply=0
Output from command ====>
version is
Note that script is echo the version being passed in, but it is null.
I tried execute the shell script(without being called by datastage) it works.
Code: Select all
./RemoveTrailer_FI_MOH_Budget.sh #VER_ID#
command:
. /u01/dstage/hpbdev/Sequential/FI/Scripts/RemoveTrailer_FI_MOH_Budget.sh
Parameters:
#VER_ID#
Log says,
JobControl (@Execute_Command): Executed: . /u01/dstage/hpbdev/Sequential/FI/Scripts/RemoveTrailer_FI_MOH_Budget.sh I
Reply=0
Output from command ====>
version is
Note that script is echo the version being passed in, but it is null.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
But it did it successfully (status = 0), which means that nothing was passed in.
Is VER_ID a parameter of the sequence? Please be aware that parameter names are case sensitive.
Is VER_ID a parameter of the sequence? Please be aware that parameter names are case sensitive.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 76
- Joined: Mon Mar 05, 2007 9:26 pm
- Location: Malaysia
So, Your script is like:
In exec command activity stage :
command:Script name
parameter:#VER_ID#
What value you are actually passing to VER_ID in job sequence?
Make sure you are properly echoing inside the script.
Else, try to simulate the same in a jobcontrol code.
Try to PRINT the output of the command.
If that also not works, then you should report to your official support provider.
Thanks
Code: Select all
version=$1
echo "version is $version"
command:Script name
parameter:#VER_ID#
What value you are actually passing to VER_ID in job sequence?
Make sure you are properly echoing inside the script.
Else, try to simulate the same in a jobcontrol code.
Try to PRINT the output of the command.
If that also not works, then you should report to your official support provider.
Thanks
pandeeswaran
-
- Participant
- Posts: 76
- Joined: Mon Mar 05, 2007 9:26 pm
- Location: Malaysia
At first it looks weird to me as well, but when it get removed, the log says,I'm curious why you have a "dot space" at the beginning of the command? Does the behaviour change if you remove that?
JobControl (@Execute_Command): Executed: ./u01/dstage/hpbdev/Sequential/FI/Scripts/RemoveTrailer_FI_MOH_Budget.sh M
Reply=1
Output from command ====>
SH: ./u01/dstage/hpbdev/Sequential/FI/Scripts/RemoveTrailer_FI_MOH_Budget.sh: not found
I am passing a character "M" into the script.What value you are actually passing to VER_ID in job sequence?
Make sure you are properly echoing inside the script.
Part of the shell script looks like this,
Code: Select all
print "$1"
VERSION="$1"
echo "version is $VERSION"
if [ "$VERSION" = "M" ]; then
VNAME=`ls -1 -F|grep "FIN_MOH_BUDGET_INITIAL_.*.csv"|grep -v [/$]`
JobControl (@Execute_Command): Executed: . /u01/dstage/hpbdev/Sequential/FI/Scripts/RemoveTrailer_FI_MOH_Budget.sh M
Reply=0
Output from command ====>
SH: print: not found
version is
Actually i just found that after "version is" there is a linefeed. I am suspecting this is the culprit. How do trim the linefeed?
-
- Participant
- Posts: 76
- Joined: Mon Mar 05, 2007 9:26 pm
- Location: Malaysia
Hi Craig,
After removing the dot and the space, it hits error as below.
JobControl (@Execute_Command): Executed: /u01/dstage/hpbdev/Sequential/FI/Scripts/RemoveTrailer_FI_MOH_Budget.sh "I"
Reply=1
Output from command ====>
SH: /u01/dstage/hpbdev/Sequential/FI/Scripts/RemoveTrailer_FI_MOH_Budget.sh: not found
After removing the dot and the space, it hits error as below.
JobControl (@Execute_Command): Executed: /u01/dstage/hpbdev/Sequential/FI/Scripts/RemoveTrailer_FI_MOH_Budget.sh "I"
Reply=1
Output from command ====>
SH: /u01/dstage/hpbdev/Sequential/FI/Scripts/RemoveTrailer_FI_MOH_Budget.sh: not found
-
- Participant
- Posts: 76
- Joined: Mon Mar 05, 2007 9:26 pm
- Location: Malaysia