DSXchange: DataStage and IBM Websphere Data Integration Forum
View next topic
View previous topic
Add To Favorites
Author Message
vsandu
Participant



Joined: 09 Aug 2010
Posts: 13

Points: 280

Post Posted: Thu Sep 20, 2012 4:30 am Reply with quote    Back to top    

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: 32

Points: 259

Post Posted: Thu Sep 20, 2012 5:17 am Reply with quote    Back to top    

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).
Rate this response:  
Not yet rated
ray.wurlod

Premium Poster
Participant

Group memberships:
Premium Members, Inner Circle, Australia Usergroup, Server to Parallel Transition Group

Joined: 23 Oct 2002
Posts: 51778
Location: Sydney, Australia
Points: 281133

Post Posted: Thu Sep 20, 2012 5:42 am Reply with quote    Back to top    

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 | Hobart | Brisbane
currently hiring: Sydney and Melbourne
Rate this response:  
Not yet rated
chulett

Premium Poster


since January 2006

Group memberships:
Premium Members, Inner Circle, Server to Parallel Transition Group

Joined: 12 Nov 2002
Posts: 38891
Location: Denver, CO
Points: 198554

Post Posted: Thu Sep 20, 2012 7:15 am Reply with quote    Back to top    

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

ORA-03113: end-of-file on communication channel
Rate this response:  
Not yet rated
rameshrr3



Group memberships:
Premium Members

Joined: 10 May 2004
Posts: 574
Location: BRENTWOOD, TN
Points: 6338

Post Posted: Tue Sep 25, 2012 11:10 am Reply with quote    Back to top    

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
Rate this response:  
Not yet rated
mobashshar
Participant



Joined: 20 Apr 2005
Posts: 87
Location: U.S.
Points: 446

Post Posted: Tue Sep 25, 2012 12:45 pm Reply with quote    Back to top    

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.
Rate this response:  
Not yet rated
chulett

Premium Poster


since January 2006

Group memberships:
Premium Members, Inner Circle, Server to Parallel Transition Group

Joined: 12 Nov 2002
Posts: 38891
Location: Denver, CO
Points: 198554

Post Posted: Tue Sep 25, 2012 1:32 pm Reply with quote    Back to top    

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

ORA-03113: end-of-file on communication channel
Rate this response:  
Not yet rated
uzl



Group memberships:
Premium Members

Joined: 23 Jul 2012
Posts: 19

Points: 164

Post Posted: Wed Sep 26, 2012 2:18 am Reply with quote    Back to top    

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 .
Rate this response:  
Not yet rated
Display posts from previous:       

Add To Favorites
View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2002 phpBB Group
Theme & Graphics by Daz :: Portal by Smartor
All times are GMT - 6 Hours