Page 1 of 1

Rename a file and empty a file

Posted: Mon Aug 01, 2005 9:47 am
by Sant
Hi everybody


I have a job which read the Balance_CG.csv file for write in a Oracle table.
After reading this file, I must copy the data in a new file named Balance_CG_yyyymmdd.csv and empty the first file.


How can I do that ?

Thank you everybody for you help.

Frederic from Paris (France)

Posted: Mon Aug 01, 2005 9:59 am
by pnchowdary
Hi Sant,
I must copy the data in a new file named Balance_CG_yyyymmdd.csv and empty the first file.
You can copy the data into a new file by simply using a transformer after you read the old file and then write to a new file called Balance_CG_yyyymmdd.csv in a sequential file stage.

By emptying the first file, if you meant delete the file
Then you need to call a shell script in the After job routine to delete the file ( you can use rm <filename>). If you want an empty file with the same name, use touch command after rm command in your shell script to create an empty file.

Posted: Mon Aug 01, 2005 10:03 am
by ukyrvd
If you copying/renaming needs to be done after the job finishes then you can use after-job-subroutine from job properties.

On the other-hand if its right after reading from file, while the job is running .. I dont think you can achieve this.. as DataStage expects the input-file/data to be there untill job finishes. If you just want to add data to the existing file you can probably use before-stage subroutine from XFM rigt after sequential stage.

Posted: Mon Aug 01, 2005 11:42 am
by Sainath.Srinivasan
An after-job move script is all you need.