Archiving processed file with timestamp

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
tom
Participant
Posts: 46
Joined: Fri Oct 14, 2005 12:38 am

Archiving processed file with timestamp

Post 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
Devlopers corner
Kirtikumar
Participant
Posts: 437
Joined: Fri Oct 15, 2004 6:13 am
Location: Pune, India

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

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
tom
Participant
Posts: 46
Joined: Fri Oct 14, 2005 12:38 am

Post 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
Devlopers corner
Post Reply