Page 1 of 1

delete a unix file from datastage sequence.

Posted: Fri Dec 23, 2005 6:21 am
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.

Posted: Fri Dec 23, 2005 6:23 am
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.

Posted: Fri Dec 23, 2005 6:54 am
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

Posted: Fri Dec 23, 2005 6:56 am
by richdhan
Veni,

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

HTH
--Rich

Posted: Fri Dec 23, 2005 1:55 pm
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.

Posted: Mon Dec 26, 2005 3:16 am
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?

Posted: Mon Dec 26, 2005 4:14 am
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

Posted: Mon Dec 26, 2005 2:49 pm
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.

Posted: Tue Dec 27, 2005 4:27 am
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.

Posted: Tue Dec 27, 2005 7:59 am
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.