Page 1 of 1

Archiving processed file with timestamp

Posted: Fri Sep 01, 2006 1:46 am
by tom
Hi Dsxians,

After processing my source file by the datastagejob i am archiving that file
by writing the following command in after job subroutine.


mv #dstage_data_dir#/MSG.txt #dstage_tmp_dir#/MSG.txt.#proc_dt#

proc_dt is one of the parameter which is passing current date.I am getting the source file five times a day and archived file is getting overwritten by 5 files data.

I want to replace proc_dt with timestamp or some unique identifier so that i will get 5 archived files for that particular day.Could any one plz help me out in solving this problem.

Thanks
tom

Posted: Fri Sep 01, 2006 3:14 am
by Kirtikumar
In move command use the date command so that it will also have seconds as a part of the file name.

So the command will be:

Code: Select all

mv #dstage_data_dir#/MSG.txt #dstage_tmp_dir#/MSG_`date '+%Y%m%d%H%M%S'`.txt

Posted: Fri Sep 01, 2006 3:14 am
by ray.wurlod
Pass a timestamp in to the job parameter or, if proc_dt is also used elsewhere in the job, provide an additional parameter containing the timestamp and use that as the file name suffix.

Posted: Fri Sep 01, 2006 4:12 am
by tom
Hi,

Thanx for both the replies.Additon of parameter will cause my script to change in all the env.kirthi's command will do my job.Once again thanks to u guys.

regards
tom