delete a unix file from datastage sequence.

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
Veni
Participant
Posts: 45
Joined: Fri Oct 21, 2005 2:51 am

delete a unix file from datastage sequence.

Post by Veni »

hi,

how to delete a unix file from datastage job.
datastage job should find test.txt file in unix server if it is exists then i should delete that file...! i want to use this process in a datastage sequencer.
Last edited by Veni on Sun Jan 01, 2006 3:19 am, edited 1 time in total.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Veni,

are you aware that you can call up UNIX commands from sequences and jobs? This will allow you to take care of your file deletion.
Veni
Participant
Posts: 45
Joined: Fri Oct 21, 2005 2:51 am

Post by Veni »

ArndW wrote:Veni,

are you aware that you can call up UNIX commands from sequences and jobs? This will allow you to take care of your file deletion.

may i know how to call unix command from sequences...
i know the rm $filename how to give this command in sequences.


Thanks
Krishna
richdhan
Premium Member
Premium Member
Posts: 364
Joined: Thu Feb 12, 2004 12:24 am

Post by richdhan »

Veni,

Use the Routine Activity Stage with ExecSH routine and rm command.

HTH
--Rich
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Use an Execute Command activity with rm as the command. The command arguments field can contain options (for example -fr) and a job parameter reference to the parameter containing the name of the file to be deleted.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Veni
Participant
Posts: 45
Joined: Fri Oct 21, 2005 2:51 am

Post by Veni »

ray.wurlod wrote:Use an Execute Command activity with rm as the command. The command arguments field can contain options (for example -fr) and a job parameter reference to the parameter containing the name of the file to be deleted.
Please can you give example?
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Hi,

Ray is just making you to make use of the facility of parameterization.
First try using hardcoded values.
rm /path/filename.txt
Then you can try the parameter instead of the path and filename
rm #path#/#filename#

-Kumar
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There are two fields on the Command tab in an Execute Command activity.

In the first (Command) you put simply the rm command itself.

In the other (Parameters) you put anything else that needs to appear on the rm command line. This can include references to job parameters, for example -rf #path#/#filename#

The command that is executed in the operating system is rm -rf path/filename where path and filename are resolved job parameter values.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Veni
Participant
Posts: 45
Joined: Fri Oct 21, 2005 2:51 am

Post by Veni »

ray.wurlod wrote:There are two fields on the Command tab in an Execute Command activity.

In the first (Command) you put simply the rm command itself.

In the other (Parameters) you put anything else that needs to appear on the rm command line. This can include references to job parameters, for example -rf #path#/#filename#

The command that is executed in the operating system is rm -rf path/filename where path and filename are resolved job parameter values.
Thanks Every one. this work fine. i need to find file is found or not how do check? if it is found then i have to go for process otherwise i need to abort the sequence ?

can any one suggest how to solve this.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

First suggestion would be to find someone where you work who can help you with simple UNIX commands like this. :wink:

Second suggestion would be to start a new post as this one has been solved and we're moving off on to another topic entirely.
-craig

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