Parameters in Command Stage

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

BIuser
Premium Member
Premium Member
Posts: 238
Joined: Thu Feb 02, 2006 4:03 am
Location: South Africa

Parameters in Command Stage

Post 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
-------------------------
https://www.ssa.co.za
sima79
Premium Member
Premium Member
Posts: 38
Joined: Mon Jul 16, 2007 8:12 am
Location: Melbourne, Australia

Post by sima79 »

See Carig's post in this threadviewtopic.php?t=126185
BIuser
Premium Member
Premium Member
Posts: 238
Joined: Thu Feb 02, 2006 4:03 am
Location: South Africa

Post 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...
-------------------------
https://www.ssa.co.za
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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?
-craig

"You can never have too many knives" -- Logan Nine Fingers
BIuser
Premium Member
Premium Member
Posts: 238
Joined: Thu Feb 02, 2006 4:03 am
Location: South Africa

Post by BIuser »

Hi there Ray,

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

Thanks
Barbara
-------------------------
https://www.ssa.co.za
BIuser
Premium Member
Premium Member
Posts: 238
Joined: Thu Feb 02, 2006 4:03 am
Location: South Africa

Post 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
-------------------------
https://www.ssa.co.za
BIuser
Premium Member
Premium Member
Posts: 238
Joined: Thu Feb 02, 2006 4:03 am
Location: South Africa

Post by BIuser »

I tried the start command - still errors ...

Thanks
Barbara
-------------------------
https://www.ssa.co.za
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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:
-craig

"You can never have too many knives" -- Logan Nine Fingers
BIuser
Premium Member
Premium Member
Posts: 238
Joined: Thu Feb 02, 2006 4:03 am
Location: South Africa

Post 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
-------------------------
https://www.ssa.co.za
BIuser
Premium Member
Premium Member
Posts: 238
Joined: Thu Feb 02, 2006 4:03 am
Location: South Africa

Post 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
-------------------------
https://www.ssa.co.za
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
BIuser
Premium Member
Premium Member
Posts: 238
Joined: Thu Feb 02, 2006 4:03 am
Location: South Africa

Post by BIuser »

I am using an execute command stage in a sequence job.
-------------------------
https://www.ssa.co.za
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply