Page 1 of 2

Parameters in Command Stage

Posted: Wed Apr 08, 2009 4:02 am
by BIuser
Hi there

Me again.

Well my sequence is working so well now, save for one final problem.

I need to tell my Command stage to read parameters since we do not want to hard-code network drive paths.

The syntax in my command textbox is the following: DIR /B/O-D
The syntax in my command parameter textbox is (which are two parameters I have set up in my sequence job with the relevant values:
#FILEPATH##FILENAME#
Error: File not Found.

When I hard-code the drive path - it works fine but when i add parameters it can't find the file. I also cannot put the parameters in the command textbox because it doesn't even compile with parameters in the command textbox.

Thanks.
Barbara

Posted: Wed Apr 08, 2009 4:28 am
by sima79
See Carig's post in this threadviewtopic.php?t=126185

Posted: Wed Apr 08, 2009 4:56 am
by BIuser
I have read Craig's response and tried what he said - but it is not finding the file ...

I put DIR /B/O-D in the first box
#FILEPATH##INPUTFILE# in the parameter box

Job fails - error: cannot find the file specified ...

Something is obviously not working ...

Then I also tried putting the DOS command also into a variable like this:
#DOSCommand##FILEPATH##INPUTFILE# - then as per Craig's message - I added sh to the command textbox - no luck. Also tried ksh - no luck...

Posted: Wed Apr 08, 2009 7:19 am
by ray.wurlod
sh won't work, since you're on Windows.

When you say "command stage" are you referring to an Execute Command activity in a sequence, or to something else?

Posted: Wed Apr 08, 2009 7:24 am
by chulett
Possibly the 'Windows only' Command stage which I've never seen. Can you post the log message that shows the actual command that was executed after the parameters were resolved? I assume this logs one like the Execute Command stage does.

For Windows without any MKS Toolkit like functionality, rather than "sh" or "ksh" perhaps "start" would work there instead?

Posted: Wed Apr 08, 2009 7:35 am
by BIuser
Hi there Ray,

I am using an Execute Command Activity in a sequence job.

Thanks
Barbara

Posted: Wed Apr 08, 2009 7:37 am
by BIuser
Hi there

This is the command output that is generated when I copy it out of the Director (together with the error message):

Load_Trans_Files..JobControl (@Cmd_TransFile_To_Load): Executed: DIR /B/O-D \\mcbcptfs01\groups\MHD\Data to load\Payroll files\TRANS files\*.csv
Reply=1
Output from command ====>
The system cannot find the file specified.

I will try START and see what happens ...

thanks
Barbara

Posted: Wed Apr 08, 2009 7:41 am
by BIuser
I tried the start command - still errors ...

Thanks
Barbara

Posted: Wed Apr 08, 2009 7:41 am
by ray.wurlod
Check that every folder in the pathname exists and that there is at least one csv file in the final folder. Otherwise DIR will return a non-zero exit status. It's clear that the parameters are being resolved.

Posted: Wed Apr 08, 2009 7:42 am
by chulett
Probably not going to make any difference since the parameters as passed are getting resolved. Are you certain there are "*.csv" files in that location and which are accessable to the DataStage job? The first (not totally conclusive) test to run is to start a "cmd" window so you get a DOS prompt and see if that exact same command works.

If it works there and not in the job, then we have a user / permissions / access problem - and yes, before you ask, even if you use "the same user". :wink:

Posted: Wed Apr 08, 2009 7:45 am
by BIuser
Hi there

I have tried using the DOS cmd prompt and the command in DOS works via the cmd window.

If I hard-code this path into the command textbox (Command Activity Stage) then it also works ... it just doesn't want to work with the parameters ?????

Thanks
Barbara

Posted: Wed Apr 08, 2009 7:48 am
by BIuser
Hi there Ray,

Yes, i've checked ... in fact I even pulled in the file path copied directly out of the Windows Explorer window. They path is definitely correct (even case) and there are two files there ... as I said, I used the exact same syntax in the cmd window and that returned the two files I am trying to load ???

Thanks
Barbara

Posted: Wed Apr 08, 2009 8:00 am
by chulett
Windows is not case-sensitive so that's not an issue here. One thing confusing me - you've now sometimes said you are using the "Execute Command" stage and here the "Command Activity" stage. Can you verify exactly which one we're talking about? Not sure it is an issue here, just want to be certain we're all singing from the same hymn book.

Posted: Mon Apr 20, 2009 7:28 am
by BIuser
I am using an execute command stage in a sequence job.

Posted: Mon Apr 20, 2009 7:37 am
by chulett
I'm at a loss here with what to try next. If you are certain that it works with hard-coded values and yet doesn't work when those exact same values are parameterized, I'm stumped. Have you involved your official support provider yet? Had another set of eyes double-check everything for you? :?

Can you post a couple of messages copied from the log, please, much like you did before? First, hard-code the values and post the command output log message like you did before. Then parameterize it with those exact same values and post that same log message again.