Page 1 of 1
Naming a file with the current timestamp?
Posted: Tue Feb 12, 2008 2:08 am
by SHARAD123
Hi all,
How to have a file name as the timestamp?
For example:
The file name should be
20070802213012.txt
Posted: Tue Feb 12, 2008 2:21 am
by WoMaWil
It depends how fine you want to have the timestamp. If you pass while starting your job the date/time as a parameter you are able to use it for the file naming.
Posted: Tue Feb 12, 2008 6:23 am
by asitagrawal
Timestamp and OConv, IConv can be combined together to acheive the results...
Posted: Tue Feb 12, 2008 7:30 am
by chulett
Or write it out with a static name and then 'after job' rename it using your O/S, adding a timestamp in the process.
Using Job Parameters
Posted: Tue Feb 12, 2008 8:55 am
by Nirmala84
Hi,
When you use a parallel extender, there s an option to include job parameter for the file name.
1) Declare a job parameter of time type.
2) Use that inside the filename column.
I think this would solve the problem.
Posted: Tue Feb 12, 2008 9:33 am
by chulett
Parallel or Server, you can always use a job parameter for part or all of a filename.
Posted: Tue Feb 12, 2008 10:23 am
by DSguru2B
Use the macro "DSJobStartTimestamp" enclosed in hashes with the file name. You will not get the format you want, but it will get you your timestamp.
Posted: Tue Feb 12, 2008 11:24 am
by paddu
Just a suggestion .
I have similar requirement and did something as below.
Achieved in Job sequence.
1) Used UserVariables activity stage(named as UV_FileDate) which passes timestamp as parameter FileDate
OCONV(@DATE, "D4YMD[4,2,2]"):'':Ereplace(OCONV(@TIME,"MT"),':','') to the job activity stage .
2) Filename in the job activity stage looks like this
'Products_':Ereplace(UV_FileDate.FileDate,'/',''):'.CSV'
Hope this information is of any help.
Thanks
Paddu
Posted: Tue Feb 12, 2008 11:49 pm
by baglasumit21
paddu wrote:Just a suggestion .
I have similar requirement and did something as below.
Achieved in Job sequence.
1) Used UserVariables activity stage(named as UV_FileDate) which passes timestamp as parameter FileDate
OCONV(@DATE, "D4YMD[4,2,2]"):'':Ereplace(OCONV(@TIME,"MT"),':','') to the job activity stage .
2) Filename in the job activity stage looks like this
'Products_':Ereplace(UV_FileDate.FileDate,'/',''):'.CSV'
Hope this information is of any help.
Thanks
Paddu
Even it is achievable using unix script in a after job routine where in you can rename the file to attach the timestamp part to it. We have done this in one of our job.