Page 3 of 4

Posted: Mon Aug 05, 2013 6:43 am
by PAULOM
It's works !

But on "Execute Command Activity", I have not found a similar command DOS (cd myfiles) to put before for /F "delims=" %A in ('dir /b *.csv') do if %~zA LSS 1024 del "%~dpnxA" in DataStage

Posted: Mon Aug 05, 2013 7:51 am
by chulett
Do you mean what goes in the 'Command' v. 'Parameters' boxes in the Execute Command stage? Shouldn't really matter, put the whole thing in either one. If you really need something, try using CMD as the Command.

Posted: Tue Aug 06, 2013 1:58 am
by PAULOM
Hi,
My JOB :


Image

In the first stage "Execute Command", the command is cd MYDIRECTORY , it's works

In the second stage, the command is for /F "delims=" %A in ('dir /b *.csv') do if %~zA LSS 250 del "%~dpnxA" but it doesn't work.

Errors :
- Command for /F "delims=" %A in ('dir /b *.csv') do if %~zA LSS 250 del "%~dpnxA" did not finish OK, reply = '1'
- delims was unexpected at this time.

What is strange, is that it works with "cmd.exe".

Please need backup.

Posted: Tue Aug 06, 2013 2:11 am
by ray.wurlod
The CD command does not "carry through" - you need both commands in a single Execute Command activity with either a ";" or a "&&" between them.

Posted: Tue Aug 06, 2013 3:33 am
by PAULOM
I try with one "Execute Command" :

cd MYDIRECTORY ; or && for /F "delims=" %A in ('dir /b *.csv') do if %~zA LSS 250 del "%~dpnxA"

It doesn't work.


This command /F "delims=" %A in ('dir /b *.csv') do if %~zA LSS 250 del "%~dpnxA" doesn't work on DataStage why?

DataStage unlike "delims" and "dir" :twisted: :twisted: :twisted:

Posted: Tue Aug 06, 2013 7:56 am
by chulett
Show us the detailed contents of the log message where the command is executed, specifically the actual command it ran. DataStage is notorious for stripping quotes, perhaps that is what is going on.

Posted: Tue Aug 06, 2013 7:58 am
by chulett
Write a batch file where you do everything that needs to be done - cd, check the size and delete - then use ERRORLEVEL to see if it succeeded. Run the .bat file in the Execute Command stage.

Posted: Tue Aug 06, 2013 10:17 am
by chulett
ps. Long overdue move just made to the General forum since nothing here is specific to either job type.

Posted: Tue Aug 06, 2013 4:41 pm
by ray.wurlod
When I stated
ray wurlod wrote:either a ";" or a "&&" between them

I did not intend for you to put ; OR %% between the two commands. I meant you to put ; between the two commands, or to put && between the two commands. That's why the word "either" was there.

Posted: Tue Aug 06, 2013 5:56 pm
by chulett
Never mind the fact that && is valid for UNIX, not DOS. :wink:

Posted: Tue Aug 06, 2013 6:11 pm
by SURA
But in Windows MKS is there!!

Ray

That mean from DS 9.1 none of the unix commands won't work??

Posted: Tue Aug 06, 2013 7:08 pm
by chulett
You mean the MKS Toolkit and AFAIK you wouldn't have it if you have a Server only license, which I believe is the case here. And for 9.1 I think that they will all still be there but will be implemented differently under the covers. At least that's the impression I got from what Ray has posted so far on the subject.

Posted: Tue Aug 06, 2013 7:22 pm
by SURA
chulett wrote:You mean the MKS Toolkit
Yes you are right. I haven't realize when i post my comment.

Posted: Tue Aug 06, 2013 9:12 pm
by ray.wurlod
chulett wrote:Never mind the fact that && is valid for UNIX, not DOS. :wink:
&& is valid for DOS.
See, for example, Conditional Execution - Conditional Execution Based on Result of Previous Command in DOS Script Snippets.

Posted: Tue Aug 06, 2013 10:47 pm
by chulett
OK then... well, never mind. I know what it means just don't recall ever seeing it used in the DOS world. Live and learn.