Putting timestamp in filename of sequential stage

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
cbres00
Participant
Posts: 34
Joined: Tue Sep 21, 2004 9:20 am

Putting timestamp in filename of sequential stage

Post by cbres00 »

I have a simple job where I am pulling data from a MS SQL table, doing some minor transforms, then writing to a sequential file stage.

I want to use time to uniquely identify the filename (I have a param in the job for date). Right now my file name in the sequential stage is

my_file_#rundate#.txt Rundate is the job param.

I'd like the file name to look like

my_file_#rundate#.HHMMSS.txt

How can I accomplish this in an elegant manner?

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

Post by ray.wurlod »

The easiest way is to have the job write to the base file name then have an after-stage or after-job subroutine run a command to change the name of the file.

For example you could invoke ExecSH as the routine, and provide the command

Code: Select all

mv #FileName# #FileName#_`date +"%Y%m%d"`_`date +"%H%M%S"`
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
cbres00
Participant
Posts: 34
Joined: Tue Sep 21, 2004 9:20 am

Post by cbres00 »

Ok! Thanks much.

CB

ray.wurlod wrote:The easiest way is to have the job write to the base file name then have an after-stage or after-job subroutine run a command to change the name of the file.

For example you could invoke ExecSH as the routine, and provide the command

Code: Select all

mv #FileName# #FileName#_`date +"%Y%m%d"`_`date +"%H%M%S"`
Post Reply