Dynamic filename for sequential file

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
onkie
Participant
Posts: 13
Joined: Thu Jul 10, 2003 2:27 am

Dynamic filename for sequential file

Post by onkie »

Hi,

I like to dynamically create a name for the outputfile for a sequential file stage. The form must be like "d:\datastage\output\file_YYYYMMDD.csv" where YYYYMMDD has to be the current date. How can I accomplish this? I tried with a user defined routine, but that's not working (either because I'm calling it the wrong way or because it ain't possible).

Thanks in advance,
Aart
rasi
Participant
Posts: 464
Joined: Fri Oct 25, 2002 1:33 am
Location: Australia, Sydney

Post by rasi »

Assign a parameter in your job (FileDateName) and before running the job pass the current date to the parameter and start your job. In the sequential stage put the parameter after the file("d:\datastage\output\file_#FileDateName#.csv

Thanks
Siva
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Alternatively, always write to the same, standard, file name and use an after-stage or after-job subroutine to compute the dynamic file name and rename the file.
(This is much easier on UNIX, where the output of the date command can be captured within the mv command, but I note that you are on Windows.)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
onkie
Participant
Posts: 13
Joined: Thu Jul 10, 2003 2:27 am

Post by onkie »

Thanks for the replies. For the moment I'm gonna use the variables variant Siva suggested.

Aart
s_boyapati
Premium Member
Premium Member
Posts: 70
Joined: Thu Aug 14, 2003 6:24 am
Contact:

Post by s_boyapati »

ray.wurlod suggestion is good. It not only works for the files with dates but also for your client/project file/parameter naming standards. By creating one routine, all team members can use. I use the same.
Post Reply