Page 1 of 1

DSExecute fail on special character

Posted: Thu Oct 14, 2004 3:33 am
by tang
Hi, all

i'm trying to write a routine which will output some of the values to a file in sun solaris system.

At command prompt i've tested echo "(" >> test2.sh successfully append into test2.sh
but it fails if i use DSExecute.

The first command in my code suceed but the 2nd one failed.

Code: Select all

command = " echo set heading off >" :ScriptF
Call DSExecute("UNIX", command, Output, SystemReturnCode)

command = "echo exec DATASTAGE_TEST_SP " :'"' : "(" :  "'": '"':Trim(Param1) : '"': "'": '" ,:x "' : ")" : '">>' :ScriptF

Call DSExecute("UNIX", command, Output, SystemReturnCode)
Is there anyone faced the same problem that can advise?

Posted: Thu Oct 14, 2004 7:38 am
by chulett
From what I recall, DataStage is stripping part of your command out before it actually executes it... the single quotes, I believe. :?

You'd be much better off if you wrote a script that does the commands you are executing and instead use DSExecute to simply run the script, passing it the parameters you may need to do so.

Posted: Thu Oct 28, 2004 1:46 am
by tang
thx guys
I've write a script and run it with DSExecute. It succeed.

Anyhow i still need to do some char parsing in the script coz DSExecute to unix strip all the " ' eventhough i put an escape infront of the special char in DS routines.

Posted: Thu Oct 28, 2004 2:24 am
by ray.wurlod
"(" has special meaning to the shell. What if you "escape" the character (precede it with a backslash), for example

Code: Select all

echo \( >> ScriptF
?
This is what you would do in UNIX if you wanted to avoid messy quote characters (for example cd \&PH\&)