Pass in parameter to ExecCommand stage

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

Moderators: chulett, rschirm, roy

agathaeleanor
Participant
Posts: 76
Joined: Mon Mar 05, 2007 9:26 pm
Location: Malaysia

Post by agathaeleanor »

Job logged,


JobControl (@Execute_Command): Executed: . /u01/dstage/hpbdev/Sequential/FI/Scripts/RemoveTrailer_FI_MOH_Budget.sh "I"
Reply=0
Output from command ====>

version is
agathaeleanor
Participant
Posts: 76
Joined: Mon Mar 05, 2007 9:26 pm
Location: Malaysia

Post by agathaeleanor »

basically nothing has passed down to the shell script :(
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

Ok. Then the final test is pass a value in parameter property in Exec Command stge. In stead of passing parameter #VER_ID# , just give some value directly.
Let's see whethee thats getting passed or not.
pandeeswaran
agathaeleanor
Participant
Posts: 76
Joined: Mon Mar 05, 2007 9:26 pm
Location: Malaysia

Post by agathaeleanor »

It is still same, no value being passed to shell script.

I am wondering if the command stage supports pass-in parameter?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

agathaeleanor wrote:I am wondering if the command stage supports pass-in parameter?
Of course it does and the log proves it - your parameter is clearly shown as part of what was "executed". The problem is all in your script and how you are calling it.

Code: Select all

Output from command ====> 
SH: /u01/dstage/hpbdev/Sequential/FI/Scripts/RemoveTrailer_FI_MOH_Budget.sh: not found
This error states that your path to the script is invalid; either it does not exist, is misspelled or you don't have the proper permissions... and I don't see how adding the "dot space" to the beginning makes it find it. :?

Rather than the relative path that you posted in your first post, what happens when you manually run that full path from the command line?

/u01/dstage/hpbdev/Sequential/FI/Scripts/RemoveTrailer_FI_MOH_Budget.sh "I"
-craig

"You can never have too many knives" -- Logan Nine Fingers
agathaeleanor
Participant
Posts: 76
Joined: Mon Mar 05, 2007 9:26 pm
Location: Malaysia

Post by agathaeleanor »

thanks chulett for your reply.
This error states that your path to the script is invalid; either it does not exist, is misspelled or you don't have the proper permissions... and I don't see how adding the "dot space" to the beginning makes it find it.
somehow, the job still able to execute the shell script by echoing words from script, like "version is "

When i executed the script in command line, it works perfectly fine.

One thing i noticed from job log is when i select the log from job all the way down, there is linefeed/carriage return (not sure how to differentiate). I strongly believe this is the culprit, but how do i trim it off? The log as below,

Code: Select all

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
<linefeed>
<linefeed>
Here i provide first part of the shell script,

Code: Select all

#!/usr/bin/ssh2
TS=`date +%y%m%d.%H%M%S`

INITIALFOLDER="/u01/dstage/hpbdev/Sequential/FI/"
ARCHIVEFOLDER="/u01/dstage/hpbdev/Sequential/FI/03_Archive/"
EXCEPTIONFOLDER="/u01/dstage/hpbdev/Sequential/FI/04_Exception/"

cd $ARCHIVEFOLDER
mkdir ${TS}
cp $INITIALFOLDER`echo "FIN_*.csv"` $ARCHIVEFOLDER${TS}/
cd $EXCEPTIONFOLDER
mkdir ${TS}
EXCEPTIONFOLDER=$EXCEPTIONFOLDER${TS}/
cd $INITIALFOLDER

VEXCEPTIONCNT=0
VFILENOTFOUNDCNT=0

VERSION="$1"
echo $1
echo "version is "$VERSION""
##MOH
if [ "$VERSION" = "I" ]; then
<codes continue>
Thanks in advance for your help.
agathaeleanor
Participant
Posts: 76
Joined: Mon Mar 05, 2007 9:26 pm
Location: Malaysia

Post by agathaeleanor »

issue resolved with,
command property: exec
parameter property: <script name> <parameter>
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Interesting, thanks for posting that. Usually you only need to do that if the path to the executable is parameterized, then as you've done something like 'exec' or the shell ('ksh' for example) go in the command box and everything goes into the parameter box.
-craig

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