Page 1 of 1

how to pass current date as filename in datastage server

Posted: Thu Sep 20, 2012 4:30 am
by vsandu
Hi ,

I want update my file name abcd_curdate.txt, once we ran the job
for ex : if we ran today abcd_20092012.txt
how we can achive please suggest on this
i am using server job and batch job, not parllel and sequence
thanks in advance

Posted: Thu Sep 20, 2012 5:17 am
by pnpmarques
If you do not want to pass the date as parameter to the job (calculated in a sequence for example), then my sugestion is to rename the file in the "after job subroutine" (Job properties).

Posted: Thu Sep 20, 2012 5:42 am
by ray.wurlod
Agreed. Use ExecSH as the after-job subroutine, and use mv as the command, with `date +%Y%m%d` as the date part of the file name.

Posted: Thu Sep 20, 2012 7:15 am
by chulett
The batch job could very easily get the current date and pass it as a parameter... or you could rename the file after job. Both ways are perfectly valid.

Posted: Tue Sep 25, 2012 11:10 am
by rameshrr3
I'm currently using an approach similar to Ray's suggestions to archive files ( cpio+gzip) once they are created using unix date command with its format modifiers. works like a charm

Posted: Tue Sep 25, 2012 12:45 pm
by mobashshar
Hi,
Just use this #DSJobStartDate# at the end of the file name. So in your case the exact name for the file will be as follows:
abcd_#DSJobStartDate#.txt

Hope this helps.

Posted: Tue Sep 25, 2012 1:32 pm
by chulett
As long as you don't mind the delimiters it brings to the party. I prefer an unformatted YYYYMMDD date so it sorts 'properly'.

Posted: Wed Sep 26, 2012 2:18 am
by uzl
I use a User Variables Activity in my sequence. Here i define the variable current_date as Oconv(@DATE,'D-YMD[4,2,2]') :'_':Oconv(@TIME,'MTS.'). This variable I pass to the job in the Job Activitythat follows the User Variables Activity.