| Author |
Message |
vsandu
Participant
Joined: 09 Aug 2010
Posts: 13
Points: 280
|
|
| DataStage® Release: 8x |
| Job Type: Server |
| OS: Unix |
| Additional info: how to pass cur date as file name dynamically |
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
|
_________________ Venkat Sandu
vsandu.cg@gmail.com |
|
|
|
 |
pnpmarques
Participant
Joined: 15 Jun 2005
Posts: 26
Points: 226
|
|
|
|
|
|
|
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).
|
|
|
|
|
 |
ray.wurlod
Participant
Group memberships: Premium Members, Inner Circle, Australia Usergroup, Server to Parallel Transition Group
Joined: 23 Oct 2002
Posts: 49922
Location: Canberra, Australia
Points: 271333
|
|
|
|
|
|
|
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.
|
_________________ RXP Services Ltd
Melbourne | Canberra | Sydney | Hong Kong
Delivering Outcomes Together |
|
|
|
 |
chulett
 since January 2006
Group memberships: Premium Members, Inner Circle, Server to Parallel Transition Group
Joined: 12 Nov 2002
Posts: 36580
Location: Denver, CO
Points: 186461
|
|
|
|
|
|
|
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.
|
_________________ -craig
It's a scheme of devices to get at low prices all goods from cough mixtures to cables
Which tickled the sailors by treating retailers as though they were all veg-e-tables
|
|
|
|
 |
rameshrr3

Group memberships: Premium Members
Joined: 10 May 2004
Posts: 519
Location: BRENTWOOD, TN
Points: 5676
|
|
|
|
|
|
|
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
|
|
|
|
|
 |
mobashshar
Participant
Joined: 20 Apr 2005
Posts: 80
Location: U.S.
Points: 412
|
|
|
|
|
|
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.
|
|
|
|
|
 |
chulett
 since January 2006
Group memberships: Premium Members, Inner Circle, Server to Parallel Transition Group
Joined: 12 Nov 2002
Posts: 36580
Location: Denver, CO
Points: 186461
|
|
|
|
|
|
|
As long as you don't mind the delimiters it brings to the party. I prefer an unformatted YYYYMMDD date so it sorts 'properly'.
|
_________________ -craig
It's a scheme of devices to get at low prices all goods from cough mixtures to cables
Which tickled the sailors by treating retailers as though they were all veg-e-tables
|
|
|
|
 |
uzl

Group memberships: Premium Members
Joined: 23 Jul 2012
Posts: 12
Points: 102
|
|
|
|
|
|
|
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 Activity
that follows the
User Variables Activity
.
|
|
|
|
|
 |
|
|