Sequentail File name has MMDDYY

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
sumitgulati
Participant
Posts: 197
Joined: Mon Feb 17, 2003 11:20 pm
Location: India

Sequentail File name has MMDDYY

Post by sumitgulati »

Hi,

I have a job that populates a sequential file from a table. The job is run once daily. Sequential file name is FEESAR_MMDDYY.txt, where MMDDYY should be dynamically assigned the date on which the job is run.

For example, if the job runs today then the file name would be FEESAR_101504.txt.
Tomorrow when the job is run the file name should be FEESAR_101604.txt.

One way to achieve this is to write a routine that gets you the current date in the required format. In the sequencer job call this routine first to capture the date value and then pass this value to the job that creates the sequential file.

Is there any better way to achieve it?

Regards,
-Sumit
ogmios
Participant
Posts: 659
Joined: Tue Mar 11, 2003 3:40 pm

Re: Sequentail File name has MMDDYY

Post by ogmios »

Nope that's about it. What do you find bad about it?

Ogmios
In theory there's no difference between theory and practice. In practice there is.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

I would write to a standard file name and execute a DOS or UNIX command to rename the file as a after job routine. Very simple to do. Several examples of this posted this week.
Mamu Kim
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Same thing I was going to recommend. :wink:

Either a script to do the renaming after job, or if you need to deliver the file via FTP do the 'renaming' as part of the file transfer.
-craig

"You can never have too many knives" -- Logan Nine Fingers
sumitgulati
Participant
Posts: 197
Joined: Mon Feb 17, 2003 11:20 pm
Location: India

Post by sumitgulati »

Thanks guys for your suggestions. Right now I am going with routine option because soon we would be shifting from Windows to Unix.

Thanks,
-Sumit
ketfos
Participant
Posts: 562
Joined: Mon May 03, 2004 8:58 pm
Location: san francisco
Contact:

Post by ketfos »

Hi
Use the following command as after job routine in your job.

cp test.csv test`date +"%Y%m%d"`.csv

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

Post by ray.wurlod »

Won't work on Windows! :lol:
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply