DSExecute problem

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
calvinlo
Participant
Posts: 31
Joined: Thu Jul 17, 2003 2:55 am

DSExecute problem

Post by calvinlo »

Hi all,

I use Call DSExecute("UNIX",myCommand, Output, ErrCode) to execute system command. but i find that if myCommand consists of double quote(") and single quote(') ..mostly as script argument....and it always fail to run.
e.g.
myCommand is testing.sh "hello '1234'"
i use "testing.sh ":'"':"hello '1234'":'"' to concat the command
and when i print out it is ok..but when i execute it seems the argument cannot be passed.

Thanks,
Cal
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Cal

You do not need to quote your arguments unless there is a space in the argument value.

Kim.


Kim Duke
DwNav - ETL Navigator
www.Duke-Consulting.com
spracht
Participant
Posts: 105
Joined: Tue Apr 15, 2003 11:30 pm
Location: Germany

Post by spracht »

Cal

in fact I also sometimes feel the need to quote things, e.g. an email subject that contains blanks or an enumeration.

It's usually helpful to first decide on which quotation mark to use on inner and outer quotation (" or '). If you want to use parameter evaluation should choose " as inner quotation mark.

I would try your example like this:

"testing.sh ":"'":"hello 1234":"'"

which will put single quotation marks around "hello 1234" thus holding it together.

Hope this helps

Stephan
calvinlo
Participant
Posts: 31
Joined: Thu Jul 17, 2003 2:55 am

Post by calvinlo »

o.. the example contains space~
and so how can i handle if the argument contains space

Thanks,
Cal
spracht
Participant
Posts: 105
Joined: Tue Apr 15, 2003 11:30 pm
Location: Germany

Post by spracht »

Cal

I think in this case

"testing.sh 'hello 1234'"

would suffice? The composition of the string like you used it is only necessary if you are using variables.


Stephan
Post Reply