Would like to not create an empty csv file

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

PAULOM
Participant
Posts: 33
Joined: Thu Jul 11, 2013 2:03 am

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

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

"You can never have too many knives" -- Logan Nine Fingers
PAULOM
Participant
Posts: 33
Joined: Thu Jul 11, 2013 2:03 am

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

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
PAULOM
Participant
Posts: 33
Joined: Thu Jul 11, 2013 2:03 am

Post 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:
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

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

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

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

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

ps. Long overdue move just made to the General forum since nothing here is specific to either job type.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

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

Never mind the fact that && is valid for UNIX, not DOS. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
SURA
Premium Member
Premium Member
Posts: 1229
Joined: Sat Jul 14, 2007 5:16 am
Location: Sydney

Post by SURA »

But in Windows MKS is there!!

Ray

That mean from DS 9.1 none of the unix commands won't work??
Thanks
Ram
----------------------------------
Revealing your ignorance is fine, because you get a chance to learn.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

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

"You can never have too many knives" -- Logan Nine Fingers
SURA
Premium Member
Premium Member
Posts: 1229
Joined: Sat Jul 14, 2007 5:16 am
Location: Sydney

Post by SURA »

chulett wrote:You mean the MKS Toolkit
Yes you are right. I haven't realize when i post my comment.
Thanks
Ram
----------------------------------
Revealing your ignorance is fine, because you get a chance to learn.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

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

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

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