space as parameter of dsjob -run

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
banactp
Participant
Posts: 52
Joined: Tue Feb 22, 2005 2:55 pm

space as parameter of dsjob -run

Post by banactp »

I need to pass a single blank space as a parameter value using dsjob:

Code: Select all

dsjob -run -jobstatus -param some_param=' ' myProject myJob
Single or double quotes used as shown above produce a syntax error:

Code: Select all

Invalid arguments: dsjob -run...
I've tried omitting the quotes, escaping the quotes, using a single backslash, different Unix shells, all to no avail and am out of ideas.

Can this be done? If so, how?
iDomz
Participant
Posts: 81
Joined: Wed Jul 25, 2007 5:25 am
Location: London

Post by iDomz »

Try this

typeset space=" "
dsjob -run -jobstatus -param some_param=$space myProject myJob


edit : you may have to put quotes around $space based on your shell. Unfortunately, I don't have access to one to try out.
banactp
Participant
Posts: 52
Joined: Tue Feb 22, 2005 2:55 pm

Post by banactp »

iDomz wrote:Try this

typeset space=" "
dsjob -run -jobstatus -param some_param=$space myProject myJob
Good idea. I tried, but it was interpreted as passing an empty string for the parameter value.

edit: Tried that, too (the quotes), but that just substituted the space so I'm back to the same syntax error I started with...
iDomz
Participant
Posts: 81
Joined: Wed Jul 25, 2007 5:25 am
Location: London

Post by iDomz »

There was hardly a chance of that working out anyways :wink:

Why not pass a random string as parameter and substitute it for space within DS?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Or set the default value in the job to a space and then don't mention the parameter name/value pair on the command line.
-craig

"You can never have too many knives" -- Logan Nine Fingers
banactp
Participant
Posts: 52
Joined: Tue Feb 22, 2005 2:55 pm

Post by banactp »

Can't set the default to a space because there is already a non-space default!

Anyway, my workaround for now (because this has to be in place by tonight) will be to add substitution handling in the sequence for some_param=NONE.

But there's got to be a better way...
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

For an "optional" parameter, you are much better off (IMHO) leaving the default empty and only supplying a value when it is actually needed. If you can.
-craig

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