Can't run app from DTS - tough one...4 me -
04-22-2004
, 03:26 AM
Hi
Here is one baffling me for a while now..
Background
Working on a Data Warehouse ETL using DTS (SQL Server 2000), which requires the running of an application (Sungard product) in order to extract data (in the form of reports). To launch an application a Password Server is run, then the report generator is run (an executable). I produced two batch files which if run manually, will run the Password Server and report generating program, along with necessary parameters
Problem
Used the DTS Execute Process Task to run one of the executables (Password Server) but did not complete. Upon running of the DTS execute process task, the executable (Password Server) is launches as epected anaccepts the parameters, but SQL Server Enterprise remains hanging (appears like it is waiting for a return code). A quick check of the Task Manager confirms that the exe is running, but Enterprise is 'not reponding'. To get past this step, I have to close the application (Password Server) and presumably, a return code indicates to Enterprise that the process has run. Indeed, Enterprise pops-up a message reporting step completed successfully.
To overcome this problem, I had to resort to using ActiveX Scripting to run the Password Server executable (using Windows Script Hosting Shell commands to execute and send keys!) - not the most elegant or robust solution
Using the Exec Shell command from a DTS ActiveX Script task (along with time waisting loops, as the 'wait' shell command does not work, and using 'sendkeys' - very ugly stuff) worked for the previous executable (Password Server) but not for the second executable (report generator). It seems that calling the 'Exec' shell command runs the executable but program's screen does not appear (hence SendKeys won't work) until there is a slight break (such as a message box). I tried very long loops which 'waist' time, but to no avail! Adding a message box, does the trick - suddnely the program window appears in a matter of seconds. But of course I can't programmatically remove the message box (modal). So, in absolute desparation I used the 'popup' Window Script Host command (with an ActiveX Script DTS Task), which produces a message box & has the option of removing the message box after a certain amount of time has elapsed, BUT that method (popup) seems to work selectively
What I am looking for is a simple way to run two executables in sequence (both have paramaters, but if forced, I can use SendKeys to 'pass' the parameters) from DTS (SQL Server 2000)
Deadlines are looming and I still have no clear way out of this mess, so any help would be greatly appreciated
Regards
Amateu |