DSExecute
Moderators: chulett, rschirm, roy
DSExecute
Hi
I'm trying a simple dos command using the DSExecute command. However I keep getting a return code of 1 meaning that it doesn't find the command.
The command is a simple 'Copy' but it can't find it.
Anyone have any kind of explanation for this ?
Also, what kind of security/priviledges do I need on the server to execute this ?
They've recently implemented a firewall so that I can't log onto the server with a datastage user anymore. I now need to check the omit username and password option and then it'll allow me to log on. Could this be the problem ? If so, any way to get around it ?
Thanks
Morne
I'm trying a simple dos command using the DSExecute command. However I keep getting a return code of 1 meaning that it doesn't find the command.
The command is a simple 'Copy' but it can't find it.
Anyone have any kind of explanation for this ?
Also, what kind of security/priviledges do I need on the server to execute this ?
They've recently implemented a firewall so that I can't log onto the server with a datastage user anymore. I now need to check the omit username and password option and then it'll allow me to log on. Could this be the problem ? If so, any way to get around it ?
Thanks
Morne
Nevermind *sigh*
It's the arabic characters again...
I've placed the following in a routine
************************************************************
FileNameLength = Len(trim(FileName))
UnQuotedFileName = trim(FileName)[2,FileNameLength - 2]
CommandString = 'Copy /Y E:\devlopment\Source\':FileName:' E:\devlopment\Source\Source.xls'
Call DSExecute("DOS", CommandString, Output, SystemReturnCode)
Ans = SystemReturnCode
************************************************************
It works fine if you give it an English filename. But somewhere the NLS for arabic just goes screwy and it doesn't work.
I'll post again if I find a solution.
Cheerio
Morne
It's the arabic characters again...
I've placed the following in a routine
************************************************************
FileNameLength = Len(trim(FileName))
UnQuotedFileName = trim(FileName)[2,FileNameLength - 2]
CommandString = 'Copy /Y E:\devlopment\Source\':FileName:' E:\devlopment\Source\Source.xls'
Call DSExecute("DOS", CommandString, Output, SystemReturnCode)
Ans = SystemReturnCode
************************************************************
It works fine if you give it an English filename. But somewhere the NLS for arabic just goes screwy and it doesn't work.
I'll post again if I find a solution.
Cheerio
Morne
Morne,
it is not only the Arabic, this would cause an error in non-NLS dos with a space in the filename. Just use double-quotes around the filename and you will be ok. (I've done that with Japanese filenames, so I've encountered the same problem before).
it is not only the Arabic, this would cause an error in non-NLS dos with a space in the filename. Just use double-quotes around the filename and you will be ok. (I've done that with Japanese filenames, so I've encountered the same problem before).
Code: Select all
CommandString = 'Copy /Y "E:\devlopment\Source\':FileName:'" "E:\devlopment\Source\Source.xls"'
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Hi Arnd
I've tried with the double quotes but it still won't work.
Do you perhaps have a dsx export of the program you used and could you mail it to me ?
My email address is kn-mhenderson@se.com.sa
Thanks for all your help so far. It's appreciated :D
Morne
I've tried with the double quotes but it still won't work.
Do you perhaps have a dsx export of the program you used and could you mail it to me ?
My email address is kn-mhenderson@se.com.sa
Thanks for all your help so far. It's appreciated :D
Morne
Sorry, I don't have any of those old projects. Can you do me a favor and test it with embedded spaces - if it works with that it really should work with NLS characters. Do you have right-to-left ordering set in DOS/Windoze?
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Embedded spaces in the filename doesn't work either so I'm assuming the double-quote fix is a must. Problem is everytime I used it, it uses the variable name (FileName) as the value. It doesn't resolve the variable first and then add double quotes to it.
I've even tried concatenating a " character to either side of the variable so that it resolves and then adds the quotes, but it doesn't work either.
I've even tried concatenating a " character to either side of the variable so that it resolves and then adds the quotes, but it doesn't work either.
Morne,
could you post your execute string? It ought to work.
could you post your execute string? It ought to work.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
SourceFileName = 'E:\development\Source\':"FileName"
TargetFileName = "E:\development\Source\Source.xls"
CommandString = 'Copy /Y ':SourceFileName:' ':TargetFileName
Call DSExecute("DOS", CommandString, Output, SystemReturnCode)
Ans = SystemReturnCode
Return (Ans)
This returns FileName as the variable name itself but doesn't resolve it.
I've also tried the following:
SourceFileName = 'E:\development\Source\':' " ':FileName:' " '
TargetFileName = "E:\development\Source\Source.xls"
CommandString = 'Copy /Y ':SourceFileName:' ':TargetFileName
Call DSExecute("DOS", CommandString, Output, SystemReturnCode)
Ans = SystemReturnCode
Return (Ans)
Doesn't work either even though this does look correct if I return the commandstring:
Copy /Y E:\development\Source\"Dist - Transformers.xls" E:\development\Source\Source.xls
TargetFileName = "E:\development\Source\Source.xls"
CommandString = 'Copy /Y ':SourceFileName:' ':TargetFileName
Call DSExecute("DOS", CommandString, Output, SystemReturnCode)
Ans = SystemReturnCode
Return (Ans)
This returns FileName as the variable name itself but doesn't resolve it.
I've also tried the following:
SourceFileName = 'E:\development\Source\':' " ':FileName:' " '
TargetFileName = "E:\development\Source\Source.xls"
CommandString = 'Copy /Y ':SourceFileName:' ':TargetFileName
Call DSExecute("DOS", CommandString, Output, SystemReturnCode)
Ans = SystemReturnCode
Return (Ans)
Doesn't work either even though this does look correct if I return the commandstring:
Copy /Y E:\development\Source\"Dist - Transformers.xls" E:\development\Source\Source.xls
Morneh,
what about the command string suggestion that I posted with quotes? And how are you getting a parameter name in there instead of it's value?
Confused,
what about the command string suggestion that I posted with quotes? And how are you getting a parameter name in there instead of it's value?
Confused,
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Hi,
Regarding:
you should have a command like:
copy /Y "source_file_full_path" "target_file_full_path"
(copy variations using wildcards and such also can be used as long as the copy command is legal)
IHTH,
Regarding:
try:SourceFileName = 'E:\development\Source\':' " ':FileName:' " '
TargetFileName = "E:\development\Source\Source.xls"
CommandString = 'Copy /Y ':SourceFileName:' ':TargetFileName
Call DSExecute("DOS", CommandString, Output, SystemReturnCode)
Code: Select all
SourceFileName = DQuote('E:\development\Source\' : FileName)
TargetFileName = "E:\development\Source\Source.xls"
CommandString = 'copy /Y : SourceFileName:' ':TargetFileName
Call DSExecute("DOS", CommandString, Output, SystemReturnCode)
copy /Y "source_file_full_path" "target_file_full_path"
(copy variations using wildcards and such also can be used as long as the copy command is legal)
IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.
Search before posting:)
Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Time is money but when you don't have money time is all you can afford.
Search before posting:)
Join the DataStagers team effort at:
http://www.worldcommunitygrid.org