Command Stage giving Error

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
maffan76
Participant
Posts: 110
Joined: Tue Aug 23, 2005 5:27 am

Command Stage giving Error

Post by maffan76 »

Hi All,
I am calling an exe file from command stage and when i execute the job it returns an error

Code: Select all

Command Failed to Execute %1
WHen i run the exe outside from DS it runs perfectly. the program is a C exe which manipules some data and generates a text file to be loaded into DB.

Thanks in advance.
Regards,
Affan
"Questioning is Half Knowledge"
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Post the syntax you are using for the command and the complete error from the job's log.
-craig

"You can never have too many knives" -- Logan Nine Fingers
lstsaur
Participant
Posts: 1139
Joined: Thu Oct 21, 2004 9:59 pm

Post by lstsaur »

Hi Affan,
You have to pass or set an value to %1 in your c program. Comand Stage has no idea what's %1.

For example the following is the content of my .bat file:
SET user=%1
SET pswd=%2
SET sid=%3
SET sp_home="c:\oracle\ora92\bin"
cd %sp_home%
call %sp_home%\sqlplus %user%/%pswd%@%sid% @c:\exestp.sql
exit

then you call this .bat file from your Command Stage and the value of the paramater for %1, user, will be passed into the %user% of the .bat file.
Hopefully, this gives you an idea.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

If you are using parameters to feed to the bat file then it is broken.
Mamu Kim
maffan76
Participant
Posts: 110
Joined: Tue Aug 23, 2005 5:27 am

Post by maffan76 »

ACtually my C pogram accepts no param, strange enough but i have solved the problem by adding the path of the C program into SHELL SEARCH PATH. i have no clue why i did that can anyone please explain this to me that whats the significance of this ENV variable and why did my command stage worked after adding the path into this variable.

Thanks in advance.
Regards,
Affan
"Questioning is Half Knowledge"
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Not strange at all - you should make no assumptions about the environment your commands run under when launched from a DataStage job. The fact that the command works under the same user from the command line is fairly meaningless. Other than to know it actually works that is. :wink:

If you had posted the requested information, it should have been obvious what the issue was: you didn't explicitly path this executable. Meaning, you put something like "thecommand" in the box when you should have put "C:\thepath\thecommand" instead. That would explain why adding the path it could be found in to that environment variable solved your problem.
-craig

"You can never have too many knives" -- Logan Nine Fingers
maffan76
Participant
Posts: 110
Joined: Tue Aug 23, 2005 5:27 am

Post by maffan76 »

I gave the complete path in the command stage and still did not work then i gave path in shell search path and it worked. why it is so?
Regards,
Affan
"Questioning is Half Knowledge"
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Probably because your program has logic that uses the PATH, just like writing a shell script that requires execution from without a specific directory can't be run from outside that directory, even with fully qualifying the command line when executing the script.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Post Reply