How to timestamp a file

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
ds_is_fun
Premium Member
Premium Member
Posts: 194
Joined: Fri Jan 07, 2005 12:00 pm

How to timestamp a file

Post by ds_is_fun »

How do i timestamp a file in DS?
Thanks
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

After-job subroutine ExecSH to mv the file to a new name that includes date. Search the forum for more details.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dsuser_cai
Premium Member
Premium Member
Posts: 151
Joined: Fri Feb 13, 2009 4:19 pm

Post by dsuser_cai »

After you create the file use the after job subroutine to rename/ move the file with a new file name.

Use the following command to rename with date or date and time

Example

file name: New.txt

mv New.txt New_`date '+%Y%m%d%`

this will rename the file with the date
-----------
If you want to add timestamp to the file then use this

mv New.txt New_`date '+%Y%m%d%H%M%S'`
Thanks
Karthick
Kryt0n
Participant
Posts: 584
Joined: Wed Jun 22, 2005 7:28 pm

Post by Kryt0n »

If using a sequence to call your job, an alternative is to pass the date in as a parameter... (User Variable set to Date()). This way, if you ever do a "View Data" on the file, at least then the file will exist.

(And take away the panic of being told the file does not exist despite the fact you have just created it!)
Post Reply