Passing parameter with spaces to Execute Command Stage

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
karry450
Participant
Posts: 201
Joined: Wed Nov 14, 2007 11:31 pm
Location: HYD

Passing parameter with spaces to Execute Command Stage

Post by karry450 »

I am using an execute command stage passing some parameters

example: Overtime Reporting/Cubes

but my shell script is recognizing only Overtime instead of Overtime Reporting/Cubes value. Can any one help me on how to pass the parameters which has spaces in it?
crystal_pup
Participant
Posts: 62
Joined: Thu Feb 08, 2007 6:01 am
Location: Pune

Post by crystal_pup »

Try passing the values within double quotes
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The space character in the directory name is your problem. As noted, you can enclose the pathname, or the directory name, in quotes.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
asorrell
Posts: 1707
Joined: Fri Apr 04, 2003 2:00 pm
Location: Colleyville, Texas

Post by asorrell »

Option 2 - create a symbolic link (with no spaces in the name) to the target and use that.
Andy Sorrell
Certified DataStage Consultant
IBM Analytics Champion 2009 - 2020
karry450
Participant
Posts: 201
Joined: Wed Nov 14, 2007 11:31 pm
Location: HYD

Post by karry450 »

Hi Ray.

The double quotes for the directory or path doesnt work still the same issue can you please help if there are any other options apart from symbolic link.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

See if this helps.
-craig

"You can never have too many knives" -- Logan Nine Fingers
asorrell
Posts: 1707
Joined: Fri Apr 04, 2003 2:00 pm
Location: Colleyville, Texas

Post by asorrell »

Hmm - that option http://www-304.ibm.com/support/docview. ... wg21386517 should only help if he was using single quotes, and earlier karry450 said he tried double quotes.

karry450, can you post the exact string you are passing the parameter?
Andy Sorrell
Certified DataStage Consultant
IBM Analytics Champion 2009 - 2020
karry450
Participant
Posts: 201
Joined: Wed Nov 14, 2007 11:31 pm
Location: HYD

Post by karry450 »

Hi

I am passing 'Overtime Reporting/Cubes' as a parameter
asorrell
Posts: 1707
Joined: Fri Apr 04, 2003 2:00 pm
Location: Colleyville, Texas

Post by asorrell »

Ok - then either use Craig's recommended environment variable in your job or switch to double quotes (" not '), that should resolve it.
Andy Sorrell
Certified DataStage Consultant
IBM Analytics Champion 2009 - 2020
karry450
Participant
Posts: 201
Joined: Wed Nov 14, 2007 11:31 pm
Location: HYD

Post by karry450 »

Hi Andy,

"Overtime Reporting/Cubes" also didn't work.
crystal_pup
Participant
Posts: 62
Joined: Thu Feb 08, 2007 6:01 am
Location: Pune

Post by crystal_pup »

I created a sequence (no environment variable used) with only execute command activity and passed the following command (under the command option) in it :-

echo "Overtime Reporting/Cubes"

Output --> "Overtime Reporting/Cubes"

Then,
Passed following under command option - echo
Passed following under parameter option - "Overtime Reporting/Cubes"

Output --> "Overtime Reporting/Cubes"

Can you try the above and let us know what you see in the director log?
It could be that the datastage is passing the value correctly, but the shell script is not acknowledging it.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

We really need to get past "doesn't work" to what the actual problem is and where it is happening. As noted, let's start with showing us what actually gets logged when the job starts as all parameters in play are logged in one of the first messages.

After that, if it looks ok, would be to show us how you are calling the script (what is where in the EC stage) and then how it is being used in your shell script. And I'd also be curious what you need to do from the command line to make your script work? If that's one value then it absolutely needs to be quoted otherwise the space turns it into two parameters.
-craig

"You can never have too many knives" -- Logan Nine Fingers
karry450
Participant
Posts: 201
Joined: Wed Nov 14, 2007 11:31 pm
Location: HYD

Post by karry450 »

crystal_pup wrote:Can you try the above and let us know what you see in the director log?
Hi
I have tried both the options

The output is as follows
Output --> Overtime Reporting/Cubes
Post Reply